Sixteen weeksscene 18 / 34~3 min

Reading SQL

The question language, read aloud.

Questions to a database get phrased in a question language rather than prose, and unusually for this story, it is a language you can already mostly read.

Any question sent to a database is a Concept · lights on your mapqueryA question sent to a database: a request to fetch or change stored information. Engineers query for application work, analysts query to investigate, product managers query to answer business questions., and for relational databases the question language is Concept · lights on your mapSQLStructured Query Language, said as sequel or S-Q-L: the language of relational databases, designed to resemble structured English, which is why reading it is far easier than writing it.. Finn queries it. The analysts query it. Dana, memorably, queries it once a quarter with one saved query somebody wrote for her, and this is normal and fine.

One question, read aloudSQL
1SELECT name, estimated_finish
fetch these columns
2FROM registrations
from this table
3WHERE bib = 11208;
for the row whose bib is Case's

Two verbs, unequal weights

Every query is one of two moods. A Concept · lights on your mapreadAn operation that fetches existing information without changing it. Reads observe state; writes create it, which is why reads are the cheaper kind to scale. looks and touches nothing: the box above is one. A Concept · lights on your mapwriteAn operation that changes stored state: adding a row, updating one, deleting one. It creates new authoritative truth, which is why it demands more care and coordination than a read. changes what is true: the tap in Act I ended in one. The asymmetry between them runs the rest of this story. Thousands of people checking a leaderboard is thousands of reads and no new truth; one chip crossing one mat is a write, and the write is sacred. Act III is, in one sentence, the day of a quarter-million writes and half a million readers.

One more cabinet exists for a different shape of problem. The live position of every runner during a race changes constantly and fits a looser mould, and it lives in a Concept · lights on your mapNoSQL databaseThe broad category of databases not built on the relational table model: document stores, key-value stores, and others, the best-known kind holding JSON-like documents. Read as not-only-SQL rather than anti-SQL., a store built for flexible documents rather than strict grids. Not a rival religion, whatever the internet says. A different tool, chosen for a different drawer, and Traversal runs both without anyone fighting in the car park.

You can now read the cabinet’s language. Next: the two promises the cabinet makes that nothing else in this story can.

End of scene

This scene covers: query, SQL, read, write, NoSQL database

Keys and relationships