Editorial illustration for DuckDB Blazes Past SQLite and Pandas in Million-Row Data Performance Test
DuckDB Smashes SQLite Speed Records in Data Performance Test
DuckDB Outpaces SQLite and Pandas in Benchmark of 1M-Row Data Tasks
A million rows of data will make your computer lie to you. It will tell you the job is done, then keep you waiting. It will burn memory in plain sight.
The usual tools, like Pandas and SQLite, are supposed to handle this. Often, they don't. So we clocked them against DuckDB, the new kid built for exactly this kind of work.
The outcome wasn't close.
// The Benchmark Queries We tested each engine on the same four everyday analytical tasks: - Total transaction value: summing a numeric column - Group by domain: aggregating transaction counts per category - Filter by location: filtering rows by a condition before aggregation - Group by domain & location: multi-field aggregation with averages # Benchmark Results // Query 1: Total Transaction Value Here we measure how Pandas, DuckDB, and SQLite perform when summing the Value column across the dataset. // Pandas Performance We calculate the total transaction value using .sum() on the Value column. pandas_results = [] def pandas_q1(): return df['Value'].sum() mem_before = memory_usage(-1)[0] start = time.time() pandas_q1() end = time.time() mem_after = memory_usage(-1)[0] pandas_results.append({ "engine": "Pandas", "query": "Total transaction value", "time": round(end - start, 4), "memory": round(mem_after - mem_before, 4) }) pandas_results Here is the output.
// DuckDB Performance We calculate the total transaction value using a full-column aggregation. duckdb_results = [] def duckdb_q1(): return duckdb.query("SELECT SUM(value) FROM bank_data").to_df() mem_before = memory_usage(-1)[0] start = time.time() duckdb_q1() end = time.time() mem_after = memory_usage(-1)[0] duckdb_results.append({ "engine": "DuckDB", "query": "Total transaction value", "time": round(end - start, 4), "memory": round(mem_after - mem_before, 4) }) duckdb_results Here is the output.
The numbers show a rout. DuckDB ran circles around the others. It was faster.
It used less memory. This exposes a basic truth about software: tools have a purpose. Pandas is a brilliant, flexible data frame.
It is also slow for big, column-wide math. SQLite is a rock-solid transaction processor. It is not an analytical engine.
DuckDB was built from the ground up to be exactly that. Its columnar design and vectorized execution are not marketing terms. They are the reason it finishes while the others are still loading.
You should not drop Pandas. For small, messy exploration, it is still the best tool. But its scale has a limit.
When you hit it, the friction is immense. DuckDB removes that friction. It makes a million rows feel trivial.
That changes what you can ask of your data. It changes what you can build. The benchmark isn't interesting because DuckDB won.
It's interesting because the old choices just got a lot simpler.
Common Questions Answered
How did DuckDB perform against SQLite and Pandas in the million-row data performance test?
DuckDB demonstrated remarkable speed and efficiency across multiple analytical tasks, consistently outperforming both SQLite and Pandas. The benchmark tested four key analytical queries including total transaction value, group by domain, location filtering, and multi-field aggregation, where DuckDB showed superior performance.
What types of analytical tasks were used to benchmark DuckDB's performance?
The performance test included four specific analytical queries: summing a numeric column for total transaction value, aggregating transaction counts per category, filtering rows by a condition before aggregation, and performing multi-field aggregation with averages. These tasks represented common data processing challenges for developers and data scientists.
Why is DuckDB considered potentially transformative for data analytics?
DuckDB offers a lightweight, open-source analytical database engine that demonstrates exceptional processing speed for million-row datasets. Its performance suggests it could be a game-changer for developers and data scientists by providing faster and more efficient data analysis capabilities compared to traditional tools like SQLite and Pandas.
Further Reading
- DuckDB vs SQLite: Million-Row Query Speed Comparison - DuckDB Lab
- DuckDB, SQLite and Pandas Comparison · Learning blog - Juan Bretti Blog
- DuckDB vs SQLite: Which Embedded Database Should You Use? - MotherDuck
- Benchmark: DuckDB, Polars, Pandas, Arrow, SQLite, NanoCube on ... - Reddit (Python)
- DuckDB vs SQLite vs Pandas: 1M Row Benchmark Results - LinkedIn (The Next Gen Tech Insider)