06-reference

sql logic vs results storage

Wed Mar 13 2024 20:00:00 GMT-0400 (Eastern Daylight Time) ·tweet ·source: x.com/@EcZachly ·by Zach Wilson
SQLdata-engineeringanalyticsData-Dotsnewsletter-angleSnowflake

SQL Logic-Storing vs Results-Storing — Zach Wilson

Summary

Zach Wilson (DataExpert.io founder, ex-Meta/Netflix/Airbnb) posted a clean taxonomy of SQL storage options organized by a single useful axis: does this store logic or results?

Original tweet: x.com/@EcZachly (176 likes, 129 bookmarks — March 14, 2024)

The Framework

Logic-storing (re-executes every time it’s called):

Results-storing (executes once, caches the output):

The key insight: a CTE called five times in one query runs five times. Most practitioners know this intuitively but have never seen it stated as a formal distinction.

Why This Is the Sanity Check Thesis

The founder flagged the framing: “explaining something people get an intuitive feel for but may not have formal training in.” That is the exact center of gravity for Sanity Check — taking practitioner intuition and giving it a name, a structure, and a mental model worth keeping.

Data engineers who’ve been burned by a slow CTE chain already know this matters. This tweet gives them the vocabulary to explain why to someone who hasn’t been burned yet.

Vault Connections

Data Dots Candidate

Strong candidate for a Data Dots card: “Logic vs Results — What Does Your SQL Actually Store?” The taxonomy is atomic, the visual could be a two-column chart with lifetimes as the y-axis, and the insight lands in one glance.

Newsletter Angle

Frame it as the question practitioners get wrong silently: “You’ve been running this CTE five times in one query. Here’s what that costs you.”