← All Kits · SQL Kit

How to Handle Large Datasets

When a file is too big for Excel · Free tools · Part of the Analyst Prep Kit

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.

New to databases? This guide assumes you can create a SQLite database and import a CSV. If you have not done that yet, start with How to Set Up a SQL Database (about 15 minutes), then come back here.
What you'll learn
  1. What actually counts as "large"
  2. Why a database beats a spreadsheet here
  3. The download quirk: it arrives zipped
  4. Importing big files (patience and disk space)
  5. The one step that makes big queries fast: an index
  6. Sample first, then run on everything
  7. 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:

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.

  1. Right-click the downloaded zip and choose Extract All.
  2. Open the extracted folder and use only the file you actually need (for us, recommendations.csv). Ignore the rest.
Why this matters: if you import the whole bundle blindly, you waste a lot of disk space and import time on files your analysis never touches. Extract, then pick.

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:

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);
Real numbers: on our 41-million-row table, building this index took about 3 minutes once. After that, joins that would have crawled ran instantly. Build it, press Ctrl+S, and you only ever pay that cost one time.

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.

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'
Rule of thumb: a query that returns zero rows or an impossible number is usually a data problem, not a logic problem. Peek at the real values before you blame your SQL.

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

SituationWhat to do
File will not open in ExcelIt is over ~1M rows. Move it into a SQLite database.
Download is a zip with extra filesExtract, use only the one file you need.
Import seems frozenA multi-GB file takes minutes. Let it finish. Check you have disk space.
Joins or filters are slowCREATE INDEX on the id column, once.
Query is slow to iterate onDevelop with LIMIT 1000, then remove it.
Tool freezes on resultsDo not SELECT * millions of rows. GROUP BY to a summary.
Filter returns nothing / weird totalsCheck 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.

Ready to put this to work?

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.

Open the SQL Kit →