What this thread does
Do first: replace read_parquet(...).lazy() with scan_parquet(...) when source-level filtering matters, then compare explain(optimized=False) and explain(optimized=True).
Short answer
As of November 2026, Python Polars 2.1.0 is the baseline; see installation and the package record. A lazy plan cannot undo an already completed eager file read. Use explicit streaming execution for diagnosis, but inspect fallback nodes and result size: lazy planning and streaming do not guarantee bounded memory.
Choose / don't choose
scan_parquet: choose when filters/projections should reach the source; confirm the optimized plan contains a Parquet scan with pushed predicates and only required columns (API).read_parquet: choose a deliberately eager result that fits memory, optionally withcolumns=[...]; don't append.lazy()expecting source-read savings (warning).- Streaming: choose batches for suitable large queries; don't assume every operator or final result can stay out of memory (streaming guide).
Not for: pandas CSV memory pressure; see pandas-memoryerror-big-csv-fewer-columns-dtypes-parquet-chunks.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
LazyFrame.explain(optimized=...) | True default for optimized logical plan | Polars current docs, November 2026 | explain |
LazyFrame.collect(engine=...) | "streaming" for batched execution returning a DataFrame; "in-memory" for comparison on bounded data; default "auto" follows affinity, otherwise streaming | Polars current docs, November 2026 | collect |
POLARS_VERBOSE | 1 to report engine fallback and its reason | Polars current docs, November 2026 | collect |
show_graph(plan_stage=..., engine=...) | plan_stage="physical", engine="streaming" to inspect physical nodes and memory-intensity legend | Polars current docs, November 2026 | streaming guide |
scan_parquet(use_statistics=...) | Default True; permits page pruning when file statistics support the predicate | Polars current docs, November 2026 | scan |
The release announcement records the change to streaming as the default and the resulting row-order considerations. Don't infer a current in-memory default from an old tutorial.
Order of operations
1. Keep the original schema and expected tiny result. Start the query at the scanner; inspect a representative file's columns and partition layout (Parquet guide). 2. Add select and filter before collection. Compare original/optimized plans: a DataFrame source means the file was already read; a Parquet scan enables source pushdown. Confirm results, not merely a shorter plan. 3. Inspect the physical streaming graph, enable verbose diagnostics, then collect a bounded sample. A selected engine unable to execute an operation may fall back to in-memory; the logical plan alone is not a memory guarantee (engine contract). 4. Compare peak memory, rows returned and elapsed time on representative inputs. For huge final output, use a suitable sink rather than collecting the complete DataFrame; supported operations still govern memory (coastalwhite's streaming tracker).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
| Eager read before lazy filtering (symptom) | read_parquet materializes first; wrapping the result changes only later operations | Start with scan_parquet, then project/filter before execution | read warning |
| Memory grows during streaming joins (symptom) | The reporter observed growing memory in multi-join streaming queries | Inspect physical nodes/fallback logs, reduce projected/filtered input, bound the result or use an appropriate sink; don't blindly increase parallelism | drumtorben's multi-join report, streaming tracker |
| Struct predicate fails to prune (symptom) | The report concerns Parquet predicate pushdown for Struct columns | Inspect scan predicate and row-group statistics; keep a minimal reproduction. kdn36's closed Delta/Struct report is historical evidence, not a blanket current defect | issue 26239 |
Missing
- No actual query, schema or memory trace is given; the fallback node and a concrete memory-safe rewrite cannot be identified.
- No throughput or universal memory ceiling follows from the engine choice.
Checked
2026-11-12; release/package/installation pages, Parquet/read/scan/explain/collect references, streaming guide and announcement, coastalwhite tracker, drumtorben report and kdn36 report read. No query or profiling commands executed.
Started from a post by @Polars documentation team, packaged by the editor. Original post