· 17 min
PostgreSQL: One Match, Three IDs, No Duplicate Fixtures
When sports feeds assign different IDs to one fixture, canonical match records, provider mappings, and guarded updates prevent duplicate data.
- #postgres
- #data-modeling
- #data-quality
Topic
26 posts ·view all posts
· 17 min
When sports feeds assign different IDs to one fixture, canonical match records, provider mappings, and guarded updates prevent duplicate data.
· 10 min
Use Snowflake AI functions in batch pipelines: filter before you classify, constrain the labels, summarize with AI_AGG, and keep the token bill visible.
· 9 min
Define metrics once in a Snowflake semantic view, query them with plain SQL or Cortex Analyst, and add materializations without forking definitions.
· 11 min
How incremental dbt models actually write: unique_key as merge grain, is_incremental filters, lookback windows, and late arrivals that silently drop rows.
· 10 min
How Dynamic Tables actually refresh: TARGET_LAG, the warehouse that pays for it, streams vs DT, and why I still keep dbt for gold.
· 10 min
What a micropartition is, how clustering and sargable filters prune, why wrapping columns and SELECT * blow the scan, and how to read partitions_scanned.
· 10 min
CREATE … CLONE shares micropartitions until someone writes. How storage grows, cloning at a timestamp, clones in CI, and why gold is never mutated via a clone.
· 5 min
Trino stores nothing. A federated SELECT * on prod Postgres is a database incident. Use Iceberg for the lake, and keep interactive SQL off OLTP.
· 8 min
How to use Cortex LLM functions inside pipelines (COMPLETE, CLASSIFY, EMBED) with cost controls, schema checks, retries, and a warehouse-native RAG shape.
· 15 min
Snowflake Time Travel and Fail-safe in practice: retention, UNDROP, cloning at a timestamp, why storage follows churn, and a restore runbook you can test.
· 8 min
Deduplication, running totals, sessionization, period-over-period comparisons, and top-N per group, plus frames, pitfalls, and live playground queries.
· 9 min
Why DuckDB replaced pandas in many pipelines: query Parquet and CSV files directly with SQL, at speeds that embarrass much bigger tools.
· 9 min
BigQuery charges by bytes scanned. Learn how partitioning and clustering cut scan costs by 90%+, and the query patterns that silently bypass them.
· 17 min
Warehouse sizing, auto-suspend, clustering, ACCOUNT_USAGE queries, and resource monitors. Estimate the bill from usage before you change prod.
· 5 min
Set up a dbt project from scratch: staging models, marts, tests, and documentation, with the project structure conventions used by real teams.
· 13 min
Working SQL for every SCD type, the point-in-time join most Type 2 builds get wrong, and a straight account of which types are worth the maintenance.
· 13 min
Joins are not the expense they were in 2015. What a wide denormalized table really costs in storage, rebuild time, and history, and the hybrid I ship instead.
· 12 min
DISTINCT, GROUP BY, ROW_NUMBER, QUALIFY, MERGE, and stream-side dedup compared on cost and semantics, plus how to pick the survivor row deterministically.
· 12 min
How WITH RECURSIVE executes, patterns for hierarchy traversal and BOM explosion, and the cycle guards that keep a bad edge from running forever.
· 12 min
Conditional aggregation, native PIVOT syntax, unpivoting wide tables, and how to handle dynamic categories without generating SQL at runtime.
· 12 min
Choosing check or timestamp snapshot strategies, what happens when a snapshot run is missed, and when a hand-rolled SCD2 model beats dbt snapshot.
· 12 min
What happens to a CTE in Postgres, Snowflake, and BigQuery, when it blocks predicate pushdown, and when referencing it twice costs you two scans.
· 12 min
The failure modes that appear after launch (join paths, metric drift, runaway cost) and the semantic layer, constraints, and evals that make text-to-SQL work.
· 12 min
How window frames actually evaluate, why RANGE and ROWS give different answers on ties, and six window patterns that delete self-joins from your models.
· 9 min
The join fan-out failure class: grain checks before and after every join, EXISTS for semi-joins, anti-joins done right, and the postmortem pattern.
· 9 min
Five SQL habits that scan more than they should: SELECT *, functions on filter columns, DISTINCT as a bug fix, OR-joins, and per-row UDF calls.