Databases & Query Optimization
How your ad and order data is stored, why reports can be slow or costly to run, and how to keep them fast and cheap — no engineering background needed.
Articles in this collection
12 articlesThe Physical vs. Logical Storage Trap
Uncompressed logical storage can quietly double a BigQuery bill. When switching to physical storage billing cuts storage costs by 50-70%, and when not.
The GA4 BigQuery export schema, explained
A marketer's guide to GA4 export's nested table structure — what event_params actually holds, and how to query it without a data engineering background.
Partitioning and Clustering, Explained With One Marketing Table
Walk through what partitioning and clustering actually do to a query, using a single GA4-style events table as the running example.
Google Ads Data Transfer vs the API
Two ways to get Google Ads data into BigQuery, with very different freshness, cost and maintenance tradeoffs. A practical comparison for choosing one.
One currency, one timezone
USD and INR spend in one column, UTC and account-timezone days in one join. The exchange-rate table, convert-then-truncate rule and view to report from.
Why your revenue doubled overnight
Ingestion doubles, fan-out joins and grain confusion multiply rows three different ways. The diagnostics that catch each and the dedup views that prevent them.
Stale dashboards lie confidently
An expired credential made a Monday review debate a demand collapse that never happened. Three layers of checks: freshness, shape and reconciliation.
Your first 10 BigQuery cost guardrails
Ten BigQuery cost controls you can set up in an afternoon, ranked by savings per hour: custom quotas, maximum bytes billed, partition filters and more.
Incremental models without dbt
Stop rebuilding a rolling table every morning without adopting a framework: MERGE, a watermark and a late-arriving-data window in plain scheduled SQL.
Joining ad spend to orders with no common key
Campaign spend and order rows share no id. The three join grains that work, the fan-out bug that breaks the naive join, and the SQL for each.
Postgres vs a warehouse for marketing reporting
Your production database can carry marketing reporting further than you think, until it cannot. Four signals it is time to move, and the cheapest next step.
How to read a database query plan
Warehouses bill by data scanned, not rows returned. How to read a query plan and estimate before you run, plus three habits that cut costs 10-100x.