← Previous · All Episodes
When LLMs Write the Database: Code Generation, Semantic SQL, and the Cost of AI Operators with Immanuel Trummer Episode 34

When LLMs Write the Database: Code Generation, Semantic SQL, and the Cost of AI Operators with Immanuel Trummer

· 01:02:47

|
Immanuel Trummer is a professor at Cornell University working where database systems meet large language models. He started on this before ChatGPT, back when every talk needed a ten-minute explanation of what a language model was.

In this episode, Immanuel walks Kostas and Nitay through three waves of that work. First, LLMs that read manuals and forum posts to tune database knobs. Then agents that write the query engine itself: GenDB generates C code specialized to your queries, data, and hardware, and can beat highly optimized traditional systems by a multiple. Finally, semantic SQL, where AI operators let you filter and join text, images, and audio, and where the whole performance problem becomes how many tokens you spend and on which model.

What we cover
  • Why forum snippets sometimes beat the official manual for database tuning, and how LLMs shrink the search space before reinforcement learning takes over
  • From CodexDB and GenesisDB (Python that barely worked) to GenDB (agent-written C that outperforms hand-built engines)
  • Per-query specialization versus generating reusable engine components that can be verified once
  • How generated code differs from classic template-based query compilation, and when the generation latency is worth paying
  • LLMs in the optimizer: predicting skew and correlated columns from schema semantics alone
  • Semantic SQL as the successor to crowdsourced databases
  • SpareLLM: profiling to pick the cheapest model that still meets your quality bar
  • Semantic joins done properly: batching rows into the prompt instead of a quadratic number of LLM calls
  • When to rewrite a semantic join into a classical join or an embedding lookup, and when you can't (the furniture-matching example)
  • Correctness without ground truth: statistical guarantees, the return of approximate query processing, and rumors of $100K queries
  • Practical knobs for trading cost against result quality, including prompt length

Chapters
  • 00:00 Intro and Immanuel's background
  • 03:12 Early days: LLMs for database tuning
  • 07:55 Combining LLMs with reinforcement learning
  • 09:16 Surprises: the tuning hints hidden in forums
  • 10:47 Could we generate a database per workload?
  • 13:39 CodexDB, GenesisDB, and GenDB
  • 18:21 Reusable generated components and verifying the code
  • 20:16 Generated code vs. traditional query compilation, and latency
  • 26:16 LLMs for query optimization
  • 32:44 "Move 37" moments in generated code
  • 35:38 Semantic SQL and multimodal data
  • 42:02 Making AI operators affordable: smaller models, fewer tokens
  • 44:25 An efficient semantic join
  • 47:50 Semantic joins vs. extracting structure up front
  • 54:51 Verification, debugging, and correctness guarantees
  • 1:03:21 Best practices for cost/quality trade-offs
  • 1:07:35 Wrap-up

View episode transcript


Subscribe

Listen to Tech on the Rocks using one of many popular podcasting apps or directories.

Apple Podcasts Spotify Overcast Pocket Casts Amazon Music
← Previous · All Episodes