Lesson 9 of 14
8. SQL vs NoSQL

Memory card and where the analogy breaks

3 min read+10 XP

The memory card (tear this page out)

#QuestionMemory code
8.1Tables, rows, keys?One table per thing, one row per item, keys for the links
8.2ACID?All or nothing, rules always hold, no peeking, written in ink
8.3Normalisation and joins?Write it once, link it everywhere, join when you read
8.4NoSQL families?Hook, folder, logbook, pinboard
8.5Schema-on-write vs read?Check at the door, or check when you open the folder
8.6Denormalisation?Store it the way you read it, and pay on every update
8.7How to choose?Money in the ledger, stories in folders; when in doubt, ledger

The whole chapter in one line: Link what must stay correct, copy what must be read fast, and choose by how you'll ask.

Where the analogy breaks

  • A ledger is slow to search by hand. A relational database isn't: with the right indexes, joins over millions of rows take milliseconds (Chapter 9).
  • A folder cabinet sits in one room. NoSQL databases are usually spread across many machines, which is exactly why they avoid joins.
  • "SQL vs NoSQL" sounds like two camps. In practice it's a toolbox, and one system often uses several databases, each for the job it fits.

Quick check

Five questions on this chapter. Pick an answer, then check it.

quiz