SQL

Analytical SQL for people who own their data. Window functions for sessionization, cohort retention triangles, funnel queries with drop-off between steps, and the query shapes that stay fast on columnar storage.

7 guides on sql.

A/B Testing in Web Analytics: Getting Significance Right

Why 'variant B is winning' usually means nothing, how to compute significance for conversion tests, and the two mistakes — peeking and tiny samples — that make most A/B results fiction.

Aug 30, 20268 min readRead

Safely Letting Users Run SQL Against Your Analytics

Exposing a SQL editor to users means accepting arbitrary queries. Parse-and-allowlist beats regex blocklists, plus row caps, statement timeouts and per-site scoping that cannot be escaped.

Aug 26, 20268 min readRead

12 SQL Queries Every Web Analytics Dashboard Needs

Copy-paste DuckDB SQL for the core web analytics metrics — traffic KPIs, top pages, referrers, entry and exit pages, new vs returning, growth, and anomaly detection.

Aug 8, 202613 min readRead

Sessionization Without Cookies

Defining a session when you cannot set a cookie. Daily-rotating identifiers, the 30-minute inactivity rule in SQL, and honest limits on cross-device and cross-day continuity.

Jul 31, 20267 min readRead

Cohort Retention Analysis in SQL: Building the Triangle Chart

How to compute cohort retention from raw events — the classic triangle table, N-day vs unbounded retention, and reading the curve without fooling yourself.

Jul 30, 20267 min readRead

SQL Window Functions for Sessionization and Funnel Analysis

How to turn a raw event stream into sessions, paths, and funnels using LAG, SUM OVER, and gap-and-island techniques — with runnable DuckDB SQL.

Jul 16, 202610 min readRead

Designing a Star Schema for Web Analytics Data

How to model pageviews, sessions, and events as facts and dimensions — grain, surrogate keys, slowly changing dimensions, and where to denormalize for a columnar engine.

Jul 6, 202610 min readRead