Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Schemas and Databases in an Agile World
Search
Andrew Godwin
April 24, 2014
Programming
4
270
Schemas and Databases in an Agile World
A talk I gave at CRAFT 2014 in Budapest
Andrew Godwin
April 24, 2014
Tweet
Share
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
350
Django Through The Years
andrewgodwin
0
260
Writing Maintainable Software At Scale
andrewgodwin
0
470
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
380
Async, Python, and the Future
andrewgodwin
2
700
How To Break Django: With Async
andrewgodwin
1
760
Taking Django's ORM Async
andrewgodwin
0
750
The Long Road To Asynchrony
andrewgodwin
0
700
The Scientist & The Engineer
andrewgodwin
1
800
Other Decks in Programming
See All in Programming
CSC305 Lecture 17
javiergs
PRO
0
340
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
290
まだ間に合う!Claude Code元年をふりかえる
nogu66
3
440
FluorTracer / RayTracingCamp11
kugimasa
0
220
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
170
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
700
Developing static sites with Ruby
okuramasafumi
0
250
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
420
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
140
生成AIを利用するだけでなく、投資できる組織へ
pospome
0
240
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
120
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
120
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
93
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Visualization
eitanlees
150
16k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
The Pragmatic Product Professional
lauravandoore
37
7.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Automating Front-end Workflow
addyosmani
1371
200k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Code Review Best Practice
trishagee
74
19k
Become a Pro
speakerdeck
PRO
31
5.7k
Transcript
Andrew Godwin @andrewgodwin DATABASES SCHEMAS in an agile world &
Andrew Godwin Core Developer Senior Engineer
Schemas Explicit & Implicit
Explicit Schema ID int Name text Weight uint 1 2
3 Alice Bob Charles 76 84 65 Implicit Schema { "id": 342, "name": "David", "weight": 44, }
Silent Failure { "id": 342, "name": "David", "weight": 74, }
{ "id": 342, "name": "Ellie", "weight": "85kg", } { "id": 342, "nom": "Frankie", "weight": 77, } { "id": 342, "name": "Frankie", "weight": -67, }
Schemas inform Storage
PostgreSQL
Adding NULLable columns: instant But must be at end of
table
CREATE INDEX CONCURRENTLY Slower, and only one at a time
Constraints after column addition This is more general advice
MySQL Locks whole table Rewrites entire storage No DDL transactions
Oracle / MSSQL / etc. Look into their strengths
Workflows Databases aren't code...
You can't put your database in a VCS You can
put your schema in a VCS But your data won't always survive.
Django Migrations Codified schema change format
None
Migrations aren't enough You can't automate away a social problem!
What if we got rid of the schema? That pesky,
pesky schema.
The Nesting Problem { "id": 123, "name": "Andrew", "friends": [
{"id": 456, "name": "David"}, {"id": 789, "name": "Mazz"}, ], "likes": [ {"id": 22, "liker": {"id": 789, "name", "Mazz"}}, ], }
You don't have to use a document DB (like CouchDB,
MongoDB, etc.)
Schemaless Columns ID int Name text Weight uint Data json
1 Alice 76 { "nickname": "Al", "bgcolor": "#ff0033" }
But that must be slower... Right?
Comparison (never trust benchmarks) Loading 1.2 million records PostgreSQL MongoDB
76 sec 8 min Sequential scan PostgreSQL MongoDB 980 ms 980 ms Index scan (Postgres GINhash) PostgreSQL MongoDB 0.7 ms 1 ms
Reasonable queries SELECT id, title FROM articles WHERE attributes->'author'->>'first_name' =
'cory'
A hybrid solution Normal columns for more static data (e.g.
id, title) Schemaless blobs for variable data (e.g. styling)
Lessons
Schemas are your friend Explicit definitions or checks will save
you
Read only mode It makes DB downtime more palatable
Work to your DBs strengths It's not just a dumb
data store
Coordinate your team A little coorindation pays big dividends
Try hybrid schemas Particularly good for CMSs or enterprise software
Thanks! Andrew Godwin @andrewgodwin eventbrite.com/jobs are hiring: