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
fs2-io を試してたらバグを見つけて直した話
chencmd
0
250
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
Compose UIテストを使った統合テスト
hiroaki404
0
110
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
150
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
200
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
720
103 Early Hints
sugi_0000
1
270
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.8k
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.1k
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
140
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
480
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
170
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.3k
Making the Leap to Tech Lead
cromwellryan
133
9k
Bash Introduction
62gerente
609
210k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
300
How to Ace a Technical Interview
jacobian
276
23k
GitHub's CSS Performance
jonrohan
1031
460k
Building an army of robots
kneath
302
44k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Adopting Sorbet at Scale
ufuk
73
9.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
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!!!