Ten Million Rows
You'll load a dataset too big for any spreadsheet into three different engines on your own laptop, make the same five questions fast in each, and write up where the time went.
About
At ten million rows, habits that were fine on a small table start to cost you. A spreadsheet won't open the file, a careless query takes minutes, and the difference between a row store and a column store becomes something you can feel. Public datasets this size are free: New York taxi trips, flight on-time data, Wikipedia pageviews, OpenStreetMap extracts, transit feeds stacked over years. This badge is loading one into SQLite, DuckDB and PostgreSQL on a laptop you already own, measuring load time, file size and query time honestly, and making five real questions fast in each engine with whatever that engine prefers: indexes, summary tables, partitioning or sort order. You'll need 20 to 50 GB of free disk, and the SQLite load will run all night if you skip the pragmas in step three. What counts is the same questions measured in every engine, with a table of numbers and an explanation that doesn't guess.
At a glance
- Per requirement
- 50 XP
- Completion bonus
- 600 XP
- Requirements
- 7
- Takes
- Four to six weekends
- Skill level
- Advanced (years of practice)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Pick a public dataset of at least ten million rows and write the schema you'll load it into before you load anything. Types matter at this size; a timestamp stored as TEXT costs you a gigabyte and a slow sort. Write the CREATE TABLE with real types and a note on which columns you expect to filter on. Take a screenshot of the schema and the dataset's size on disk. Photo
-
2
Load it into PostgreSQL with COPY and into DuckDB with read_csv, and record the load time and on-disk size of each. Postgres wants COPY, not INSERT, and wants the indexes created after the load rather than before, which can be a tenfold difference on its own. DuckDB will probably finish before the kettle does. Take a screenshot of both timings and both sizes. Photo
-
3
Load it into SQLite too, with the pragmas that make a bulk load survivable, and record the same numbers. Set PRAGMA journal_mode = OFF and PRAGMA synchronous = OFF for the load only, wrap the whole import in a single transaction, and build indexes afterwards. Without those three, a ten million row load can run all night and still be going at breakfast. Take a screenshot of the timing and size. Photo
-
4
Write five questions and time each one cold in all three engines, in a table. A filter on a date range, a GROUP BY over the whole table, a join to a small lookup table, a top-N, and a median or percentile. Cold means after a restart or with the cache dropped, and run each three times and keep the middle number. Take a screenshot of the fifteen-cell table. Photo
-
5
Make the slowest question in each engine at least five times faster, using what that engine prefers. An index or a partial index in Postgres, a summary table refreshed by a query, partitioning by month, or a sorted load order in DuckDB. Show the plan before and after in each engine, because a faster number without a plan is luck. Take a screenshot of the new timings beside the old. Photo
-
6
Answer a question about the real world from the data. Which hour of the day is busiest, how delays changed over a decade, where the edits cluster. Post the result as a table or a quick chart, with the query that made it. Photo
-
7
Write 600 words on where the time went and which engine you'd choose for what. Say what surprised you and what you'd load differently next time. Post it with the timing table. Photo