~/talk

Eager Loading for ActiveRecord Performance

Talkat Balkan Ruby 2018 · 2018-05-25..05-26· [ruby-on-rails, web-performance]
name:Dinah Shi
github:dinahshi
slides:none on file

Explains how ActiveRecord turns an N+1 into fewer queries using includes -> 2 queries and how includes chooses between the two-query preload strategy and a slower LEFT OUTER JOIN eager_load; shows preload and eager_load APIs and when to force them. Demonstrates counter_cache cutting many queries to 1 query by storing counts (migration + backfill required) and shows Russian-doll fragment caching combined with fast_jsonapi and Bullet to eliminate DB reads for warm caches; demo with 10 posts × 1,000 comments (10,000 records) validates the approach.

AI-written summary · about

  1. 0:00Start
  2. 9:33Chaining
  3. 11:13Relations execute queries lazily
  4. 16:02#preload
  5. 28:44on a cold cache
  6. 32:35the power of lazy
  7. 34:16THE NETFLIX TECH BLOG
~/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.