internalsGet Pro

Module 03 · Lesson 6 of 10Pro

Processing data larger than memory

Level
Intermediate
Topic
Python for data engineering
Reading time
16 min

When you finish this page you can

  1. Estimate a job’s memory from the state its operators keep, not from the size of its input.
  2. Explain how DuckDB streams a scan through a query and spills a large GROUP BY to disk when it reaches its memory limit.
  3. Set memory_limit, temp_directory and max_temp_directory_size for a job that shares a server with other work.
  4. Choose between DuckDB SQL, Polars streaming, a Python loop over chunks and a cluster for a job bigger than memory.
  1. Writing fast analytical queries17 min
  2. DataFrames: pandas and Polars14 min
  3. Reading and writing databases from Python16 min

Thirteen months of clicks on an 8 GB server

is an online store in India. Every night from 01:00, a cron job copies the day’s orders and click events from a PostgreSQL into on one server with 8 GB of memory. Daniel, who leads finance reporting, reads the results at 07:00. The job also writes each night’s clicks to exports/clicks_<night>.parquet for the ML team.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan