DuckDB is a column-oriented database. This is why it's so fast compared to SQLite for a lot of analytical queries. CSV is a row-based format. DuckDB has to load it completley to memory before it can run any queries. Depending on the amount of RAM and Swap you have avialable, it's better to use parquet or similar column-based formats for data storage. Even SQLite as format is faster than CSV, since SQLite is already optimized, integers and floats take less space in SQLite format than as CSV.