How to Handle Large Datasets
You double-click a data file and Excel spins, freezes, or tells you it cannot open it. Real-world datasets are often far bigger than a spreadsheet can hold, and every beginner hits this wall the first time they grab a serious dataset. This guide is what to do next: how to recognize a "large" dataset, why you move it into a database, and the handful of real-world quirks that trip everyone up on the way.
- What actually counts as "large"
- Why a database beats a spreadsheet here
- The download quirk: it arrives zipped
- Importing big files (patience and disk space)
- The one step that makes big queries fast: an index
- Sample first, then run on everything
- Aggregate early, and check your data types
First: what counts as "large"?
"Large" is not a vibe, it has real thresholds. A dataset is large enough to need this guide when any of these are true:
- It has more than about a million rows. Excel and Google Sheets stop at 1,048,576 rows. Past that, the file physically cannot fully open. Rows beyond the limit are silently dropped.
- It is hundreds of megabytes to several gigabytes on disk.
- Your spreadsheet freezes, crashes, or says "not enough memory" when you try to open it.
The running example in this guide is a real one: a public dataset of Steam game reviews, recommendations.csv, at about 2 GB and 41 million rows. Excel will not open it. A database will handle it without blinking.
Step 1 — Move it into a database, not a spreadsheet
The single most important move: stop trying to open large data in a spreadsheet. Put it in a database instead. SQLite (via the free DB Browser app) has no practical row limit. The same file that crashed Excel becomes a table you can query in seconds.
This is exactly the create, import, verify workflow from the SQL database guide. The steps are identical for a big file. It just takes longer, which is what the rest of this guide prepares you for.
Step 2 — Expect the download to be zipped (with extras you don't need)
Large public datasets almost never download as a single clean CSV. They arrive as a .zip (often named something generic like archive.zip) that contains several files bundled together. In our example the zip held four files, and we only needed one.
- Right-click the downloaded zip and choose Extract All.
- Open the extracted folder and use only the file you actually need (for us,
recommendations.csv). Ignore the rest.
Step 3 — Import is slow, and the file grows. That's normal.
A 2 GB CSV does not import instantly. Give it time. Two things surprise people, and both are expected:
- The import takes minutes, not seconds. DB Browser may look frozen while it works. Let it finish.
- Your
.dbfile grows to several gigabytes. A 2 GB CSV can produce a multi-GB database. Make sure you have the free disk space before you start: the original CSV plus the database can easily total 4 to 6 GB.
Import the file exactly as in the SQL guide (name the table something ending in _raw, tick "column names in first line"), then press Ctrl+S to save.
Step 4 — Build an index (the step that makes big queries fast)
An index is a lookup shortcut on a column. Without one, every time you search or join on that column, the database reads all 41 million rows from top to bottom. With one, it jumps straight to the rows it needs. On a small table you never notice. On a big one, it is the difference between instant and unusable.
Build the index once, on the column you will join or filter on most (usually an id):
CREATE INDEX IF NOT EXISTS idx_rec_appid ON recommendations(app_id);
Step 5 — Write your query against a sample first
You do not want to wait on 41 million rows every time you fix a typo in your query. Develop against a small slice, then run the finished query on everything.
- Add
LIMIT 1000while you are writing and testing, so results come back instantly. - Or keep a small sample CSV (a few thousand rows) as a separate table for building queries.
Once the query is correct on the sample, remove the LIMIT and run it for real.
Step 6 — Aggregate early, and never dump millions of raw rows to the screen
Asking a tool to display 41 million rows is what freezes it. You almost never want the raw rows anyway, you want a summary. Use GROUP BY to collapse the data to one row per thing you care about:
SELECT app_id, COUNT(*) AS num_reviews, AVG(hours) AS avg_hours
FROM recommendations
GROUP BY app_id;
That turns 41 million review rows into one tidy row per game. Reach for COUNT, AVG, SUM, and GROUP BY before you ever reach for SELECT *.
The quirk that quietly breaks a filter: data types
Before you trust any filter on a big table, look at the actual values first (SELECT * FROM recommendations LIMIT 10;). Large real-world files love to store things in surprising ways. The classic: a true/false column stored as the text 'true' and 'false', not the numbers 1 and 0.
If you assume it is a number and write WHERE is_recommended = 1, it silently matches nothing, and you get a confidently wrong answer with no error message. The fix is simply to match how the data is really stored:
WHERE is_recommended = 'true'
One more honest habit: mind the snapshot
Large datasets are point-in-time snapshots. If you join two big datasets, they may have been collected on different dates (ours were), so they describe the same things at slightly different moments. That is fine, but say so in your write-up. Being upfront about where your data came from and where two sources do not perfectly line up is part of doing the analysis honestly.
Cheat sheet
| Situation | What to do |
|---|---|
| File will not open in Excel | It is over ~1M rows. Move it into a SQLite database. |
| Download is a zip with extra files | Extract, use only the one file you need. |
| Import seems frozen | A multi-GB file takes minutes. Let it finish. Check you have disk space. |
| Joins or filters are slow | CREATE INDEX on the id column, once. |
| Query is slow to iterate on | Develop with LIMIT 1000, then remove it. |
| Tool freezes on results | Do not SELECT * millions of rows. GROUP BY to a summary. |
| Filter returns nothing / weird totals | Check data types. A boolean may be text 'true', not 1. |
When SQLite is not enough
SQLite comfortably handles many-gigabyte files, which covers almost everything you will meet while learning and building a portfolio. If you ever outgrow it, the next tools are DuckDB (built for fast analytics on big files) and pandas with chunksize in Python (read a huge file in pieces). The mindset you just learned carries straight over: put it in a database, index the key, sample while you build, aggregate before you display.
The free SQL Kit teaches the exact tools that tame big data: JOIN, GROUP BY, and aggregate functions, with worked examples, practice, and a mock exam. All in your browser, nothing to install.