When SQL works perfectly and breaks everything | Saturdata
Автор: Saturdata Podcast
Загружено: 2026-03-08
Просмотров: 28
Описание:
Think SQL is just SELECT and GROUP BY? Sam dives deeper into the queries that actually show up in data work, from window functions that rank without collapsing, to the one DuckDB clause that makes filtering on window results actually readable. Plus: why running your pipeline twice can quietly wreck your data, and how CTEs and subqueries are more similar than your tech lead wants to admit.
📓 Marimo notebook: https://github.com/saturdata/resource...
We talk about:
Window functions: ROW_NUMBER vs RANK vs DENSE_RANK (and when -the difference actually matters)
Running totals, moving averages, and LAG/LEAD for time series work
QUALIFY, FILTER, and other clauses you didn't know you needed
CTE vs subquery: what the execution plan actually shows
PIVOT and UNPIVOT for when your stakeholder wants it wide and your database wants it long
Idempotent operations and why INSERT INTO is a trap in pipelines
How to debug a complex query without losing your mind
Follow Saturdata, your favorite weekend data podcast:
Spotify: https://open.spotify.com/show/5QolhKm...
LinkedIn: / saturdata
Instagram: @SaturdataPod
#Saturdata #SQL #DuckDB #DataEngineering #WindowFunctions
Chapters:
0:00 - Welcome to Saturdata
1:22 - Firing up the Marimo notebook
3:16 - Why DuckDB sparks joy (and dark mode debate)
4:57 - Setting up the environment: DuckDB, Polars, and friends
8:33 - Loading and peeking at the NYC taxi data
11:55 - CTEs vs. subqueries: a tale of readability
13:00 - Window functions demystified: row number, rank, and dense rank
19:02 - Quintiles, quantiles, and a live Google session
26:00 - Running totals, moving averages, lag and lead
31:02 - DuckDB-flavored magic: qualify, filter clause, and pivots
37:24 - CTE vs. subquery performance: reading the EXPLAIN output
49:32 - Idempotency and why INSERT INTO can ruin your day
51:40 - Query optimization tips
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: