01OLTP vs OLAP
Databases are built for one of two jobs.
| OLTP (transactions) | OLAP (analytics) | |
|---|---|---|
| Typical query | insert/update one order, look up one customer | average price by region over 3 years |
| Rows touched | a few | millions |
| Columns touched | all of a row | a few |
| Storage | row-oriented | column-oriented |
| Examples | PostgreSQL, SQLite, MySQL | DuckDB, BigQuery, Snowflake |
DuckDB is "SQLite for analytics": it runs inside your Python process with no server, but uses a columnar, vectorised engine that processes values in CPU-cache-sized batches. On a laptop it can scan Parquet files faster than many clusters on data under ~50 GB.