You don't have to use a document DB
(like CouchDB, MongoDB, etc.)
Slide 21
Slide 21 text
Schemaless Columns
ID int Name text Weight uint Data json
1 Alice 76 { "nickname": "Al",
"bgcolor": "#ff0033" }
Slide 22
Slide 22 text
But that must be slower...
Right?
Slide 23
Slide 23 text
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
Slide 24
Slide 24 text
Reasonable queries
SELECT id, title FROM articles
WHERE attributes->'author'->>'first_name' = 'cory'
Slide 25
Slide 25 text
A hybrid solution
Normal columns for more static data (e.g. id, title)
Schemaless blobs for variable data (e.g. styling)
Slide 26
Slide 26 text
Lessons
Slide 27
Slide 27 text
Schemas are your friend
Explicit definitions or checks will save you
Slide 28
Slide 28 text
Read only mode
It makes DB downtime more palatable
Slide 29
Slide 29 text
Work to your DBs strengths
It's not just a dumb data store
Slide 30
Slide 30 text
Coordinate your team
A little coorindation pays big dividends
Slide 31
Slide 31 text
Try hybrid schemas
Particularly good for CMSs or enterprise software
Slide 32
Slide 32 text
Thanks!
Andrew Godwin
@andrewgodwin
eventbrite.com/jobs
are hiring: