Processing 100GB of Parquet data on a single machine used to mean spinning up a Spark cluster or watching your OOM killer go to work. Polars LazyFrames change that equation entirely. By deferring execution and building a logical query plan, you can manipulate datasets larger than RAM using a fraction of the memory footprint—if you know how to drive the optimizer.
Why Lazy Evaluation Changes the Game
Eager DataFrames execute every line immediately. A 100GB filter-then-groupby operation materializes the filtered 80GB intermediate result before the aggregation runs. LazyFrames build a Directed Acyclic Graph (DAG) of expressions instead. The optimizer sees the full picture: it pushes predicates down to the Parquet scan, prunes columns, and fuses operations into a single streaming pass. No intermediate materialization. No memory spikes.
Predicate Pushdown: The First Line of Defense
Parquet stores min/max statistics in row group footers. When you filter on a partitioned column or a column with statistics, Polars skips entire row groups before decoding a single value. The catch: statistics only exist for the first 10 columns by default in many writers. Ensure your filter columns are written early in the schema or explicitly enable statistics for them.
Column Pruning: Read Only What You Need
A 100GB dataset with 200 columns might only need 5 for your analysis. Parquet is columnar—reading unused columns wastes I/O and decode cycles. Always call `.select()` immediately after the scan. Polars will only project required columns through the entire plan, and the Parquet reader will skip the rest entirely.
Streaming vs. Collect: Memory Profile Decisions
`.collect()` pulls the full result into memory. `.collect(streaming=True)` processes chunks sequentially, keeping memory constant regardless of output size. Use streaming for ETL sinks (writing Parquet, inserting to DB) or when the result exceeds RAM. Disable streaming only when you need the final DataFrame in memory for downstream Python operations.
| Method | Memory Use | Use Case |
|---|---|---|
| collect() | O(result_size) | Exploratory analysis, ML feature matrices |
| collect(streaming=True) | O(chunk_size) | ETL pipelines, large exports, DB inserts |
| sink_parquet() | O(chunk_size) | Direct Parquet output, zero memory copy |
Join Optimization: Broadcast vs. Hash
Joining a 100GB fact table with a 10MB dimension table? Polars defaults to a hash join. Force a broadcast join by hinting the small side: `pl.col("dim").implode()` isn't valid syntax, but you can ensure the small table is eager and the large table lazy. Polars will broadcast the eager DataFrame to all threads.
Inspect the Plan Before You Run
Never guess. Call `.show_graph()` or `.explain()` on the LazyFrame to see the optimized plan. Look for `PARQUET SCAN` with `projection` and `selection` fields populated. If you see `FILTER` nodes above the scan, predicate pushdown failed—check your expression syntax or Parquet statistics.
Sink Directly to Disk
The ultimate optimization: never materialize the result in Python at all. Use `.sink_parquet()` or `.sink_csv()` on the LazyFrame. Polars writes the streaming output directly to disk in parallel, bypassing the GIL and memory allocation entirely. This is how you process 100GB on a 16GB laptop.
✦
Start your next 100GB job with `pl.scan_parquet`, chain `.select`, `.filter`, and `.group_by` natively, then `.sink_parquet()` with `streaming=True`. Open the query plan. Verify predicate pushdown and column projection. That's the entire loop. No cluster required.










