~/talk

Twenty Thousand Leagues Under ActiveRecord

Talkat Barcelona Ruby Conference 2014 · 2014-09-11..09-13· [ruby, databases]
slides:none on file

A Rails call like user.where(name: 'Captain Nemo').first builds an ActiveRecordRelation that constructs an Arel gem abstract syntax tree; a Postgres visitor then generates SQL with a $1 bind. Postgres parses that SQL back to its own AST, makes a plan and executes it; without an index a sequence scan reads the whole table and sort pulls all rows, but adding an index creates a sorted copy so an index scan replaces sequential scan and uses binary search/B‑tree logic with Lehman & Yao sibling pointers to allow concurrent inserts; run EXPLAIN to confirm.

AI-written summary · about

  1. 0:00Start
  2. 3:41Agenda
  3. 11:38Relational Algebra
  4. 12:46The Abstract Syntax Tree
  5. 14:37Visitor Pattern
  6. 16:04Join Source
  7. 18:47How Database Servers Work
  8. 19:21Parser Generator Engine
  9. 20:23Abstract Syntax Tree
  10. 21:40Analyzed and Rewrite
  11. 24:26Sequence Scan
  12. 25:57Captain Nemo
  13. 32:09B-Tree Algorithm
  14. 36:15Balance Tree Algorithm
  15. 36:40Indexes in Postgres
  16. 37:12Recap
  17. 38:03Ruby under a Microscope
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.