Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
5分でわかるAdequateRecord
Search
Tomohiro MITSUMUNE
October 31, 2014
Programming
1
460
5分でわかるAdequateRecord
#dena_rubykaigi01 LT資料
Tomohiro MITSUMUNE
October 31, 2014
Tweet
Share
More Decks by Tomohiro MITSUMUNE
See All by Tomohiro MITSUMUNE
某サービスのリニューアルでECSを導入したよもやま話
tmitz
1
2.6k
Swift2 New Features
tmitz
0
130
Other Decks in Programming
See All in Programming
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
2
1.7k
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
210
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.6k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
250
Vaporモードを大規模サービスに最速導入して学びを共有する
kazukishimamoto
4
4.3k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
9
1k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
7
2.8k
macOS でできる リアルタイム動画像処理
biacco42
7
1.9k
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.4k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
140
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
4
330
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
167
14k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
A Tale of Four Properties
chriscoyier
156
23k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.9k
We Have a Design System, Now What?
morganepeng
50
7.2k
Gamification - CAS2011
davidbonilla
80
5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Making the Leap to Tech Lead
cromwellryan
132
8.9k
Navigating Team Friction
lara
183
14k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Adopting Sorbet at Scale
ufuk
73
9k
Transcript
5ͰΘ͔Δ AdequateRecord @t_mitz
࠷ॳʹ
"[VTBUIFNF ͔ͿΓ͗͢Ͱ͢ ਓ IUUQTHJUIVCDPNTBOPHSBQIJYB[VTBLFZOPUF
2"EFRVBUF3FDPSE JTԿ
"3BJMTͰՃ͞ΕΔ .BKPS'FBUVSFTͷͭ
Rails 4.2ͷMajor Features • ActiveJob • AdequateRecord • Web Console
• Foreign key support
ݱࡏɺCFUB ͋ͨΓʹຊϦϦʔε͞Εͦ͏
ͱࡢॻ͍ͨΒ ຊCFUBϦϦʔε ͞Εͯ·ͨ͠ IUUQXFCMPHSVCZPOSBJMTPSH3BJMT CFUBIBTCFFOSFMFBTFE
ؓٳ
–Rails 4.2 Release Notes “Adequate Record is a set of
refactorings that make Active Record find and find_by methods and some association queries upto 2x faster.”
ࡶʹ༁͢ͱ
lϦϑΝΫλϦϯάͰ "DUJWF3FDPSEΛ ഒͨͥ͘͠ʂz
None
lਪଌ͢ΔͳܭଌͤΑz ͷֶʹج͖ͮϕϯνϚʔΫ
IUUQUFOEFSMPWFNBLJOHDPN BEFRVBUFSFDPSEQSPMJLFBDUJWFSFDPSEIUNM
3BJMT 3BJMTCFUB
ϗϯτʹ ഒʂʂʂ
੍͕͋Γ·͢
OK Query Article.find 1 Article.find_by_title ‘foobar’ ! article
= Article.find 2 article.comments
NG Query Article.where(title: ‘foobar’)
.where(user: 1) ! Article.find(1, 2, 3) ! Article.find_by ‘published_at < ?’, 2.weeks.ago
ҰମͲ͏ͬͯ ͯ͘͠Δͷ͔
None
IUUQUFOEFSMPWFNBLJOHDPN BEFRVBUFSFDPSEQSPMJLFBDUJWFSFDPSEIUNM
42-4USJOHͷ 5SBOTGPSNΛຖճͤͣ Ωϟογϡͯ͠ߴԽ
ಥવͷ ίʔυϦʔσΟϯά
;ΉɺCSBODI͕͋ΔΒ͍͠ http://tenderlovemaking.com/2014/02/19/adequaterecord- pro-like-activerecord.html
None
ແ͍͠ʂʂʂ
NBTUFSʹNFSHF͞Εͨͷ ͰEFMFUF͞Ε͍ͯ·ͨ͠
DPNNJUMPH͔ΒͦΕΆ͍࣮ Λ୳͢͜ͱํʹมߋ
͕Ή͠ΌΒʹίʔυͬͯ ͭΒ͍ͷͰώϯτ୳͠
;Ήɺ3BJMTϦϦʔεͨ͠ޙʹ NFSHF͢Δએݴ http://tenderlovemaking.com/2014/02/19/adequaterecord- pro-like-activerecord.html
Rails 4.1 Released 2014/04/08 IUUQXFCMPHSVCZPOSBJMTPSH3BJMT
IUUQTHJUIVCDPNSBJMTSBJMTDPNNJUTNBTUFS BDUJWFSFDPSE QBHFBVUIPSUFOEFSMPWF
ϦϦʔεʹ NFSHFͯͨ͆͠
None
"DUJWF3FDPSE4UBUFNFOU $BDIFͰΩϟογϡੜͯ͠Δ Έ͍ͨͰ͢Ͷ
ৄ͘͜͠ͷ͋ͨΓͷίʔυ • https://github.com/rails/rails/blob/master/ activerecord/lib/active_record/core.rb • https://github.com/rails/rails/blob/master/ activerecord/lib/active_record/ statement_cache.rb • https://github.com/rails/rails/blob/master/
activerecord/test/cases/statement_cache_test.rb
ͪͳΉͱ"34UBUFNFOU$BDIF ͷςετέʔεʹKPJOXIFSFͰ Ωϟογϡੜͷςετ͕͋ΔͷͰɺ কདྷpOEܥ౷Ҏ֎ վળ͞ΕΔ͔͠Εͳ͍
TL;DR
ಛʹؾʹ͠ͳͯ͘ ͔ΒpOEܥ͕ഒ
Enjoy Rails way!!!