Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Django QuerySet "ARE" Patterns
Search
HayaoSuzuki
May 18, 2019
Technology
3.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Django QuerySet "ARE" Patterns
DjangoCongress JP 2019 Lightning Talk
HayaoSuzuki
May 18, 2019
More Decks by HayaoSuzuki
See All by HayaoSuzuki
Let's implement useless Python objects (revised)
hayaosuzuki
0
62
Tomorrow graphlib, Let us use everybody
hayaosuzuki
1
2.4k
Tasting "Python Distilled"
hayaosuzuki
0
420
Let's implement useless Python objects
hayaosuzuki
0
2.1k
How to Write Robust Python Code
hayaosuzuki
5
4.8k
Unknown Evolution of the Built-in Function pow
hayaosuzuki
0
1.5k
Python for Everyday
hayaosuzuki
1
2.5k
How to Use In-Memory Streams
hayaosuzuki
1
6.5k
Do you know cmath module?
hayaosuzuki
0
3.4k
Other Decks in Technology
See All in Technology
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
140
メルペイ 会計システム概要と歴史
mewuto
0
190
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
300
AgentCoreで実践するハーネスエンジニアリング
yakumo
1
290
生成AIで高い生産性を求められて、 悩み、乗り越えた話
mot_techtalk
2
130
検証フェーズはAIの回答を判断するための学習機会
toru_kubota
2
530
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
540
おそらく日本で唯一のDevRelインターン生として
husengs7
0
170
分析AIエージェントを育てる、動く環境を育てる
codatum
1
370
不可逆な意思決定を避けながら10億超の顧客データを AI Ready にするデータ基盤設計
baseballyama
1
170
ビジネスを止めない技術的負債の返済のための戦略とその手法 - 技術的負債と向き合う / Complexity and Simplicity
soudai
PRO
3
660
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
880
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
620
The untapped power of vector embeddings
frankvandijk
2
1.9k
Automating Front-end Workflow
addyosmani
1369
210k
Embracing the Ebb and Flow
colly
88
5.2k
The Pragmatic Product Professional
lauravandoore
37
7.5k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
450
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
700
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Transcript
明日から使うな! Django QuerySet アレパターン Hayao Suzuki @CardinalXaro
おまえ誰よ • Hayao Suzuki @CardinalXaro • 株式会社アイリッジ ◦ Pythonエンジニア ◦
テックリード(自称) • オライリージャパンの回し者 ◦ テクニカルレビュワー(自称)
今日のテーマ • Django QuerySetでやらかした思い出を語る。 • 本日、スマートフォンで作ったスライドなので手抜きです。 • この発表はフィクションであり、営業さんが客先で軟禁されたとか エンジニアが土日待機したなどの事実はありません。
indexを張らずにDBがスパイクした • token = models.TextField(max_length=200) • token = models.CharField(max_length=200, db_index=True)
年月日で調べたい 'regist_dt__year': today.year, 'regist_dt__month': today.month, 'regist_dt__day': today.day
なんだこれは、たまげたなあ WHERE (EXTRACT(DAY FROM `regist_dt`) = 28 AND EXTRACT(MONTH FROM
`regist_dt`) = 1 AND `regist_dt` BETWEEN '2019-01-01 00:00:00' AND '2019-12-31 23:59:59.999999'
こうした 'regist_dt__gte': datetime.datetime.combine(datetime.date.today(), datetime.time.min), 'regist_dt__lte': datetime.datetime.combine(datetime.date.today(), datetime.time.max),
そうそうこれだよ WHERE (`regist_dt` >= 2019-01-28 00:00:00 AND `regist_dt` <= 2019-01-28
23:59:59.999999
結論 • 実行計画調べよう • SQL見よう • LT資料は事前に準備しよう