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
Tuning SQL Date Range Queries
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Chris
November 01, 2019
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Tuning SQL Date Range Queries
Chris
November 01, 2019
More Decks by Chris
See All by Chris
Create reusable SQL expressions with SQL macros
chrissaxon
0
150
All About Insert
chrissaxon
0
190
Generating days between two dates
chrissaxon
0
260
Converting rows to columns and back again
chrissaxon
0
230
Finding the Longest Common Substring & Gestalt Pattern Matching with SQL & PL/SQL
chrissaxon
0
730
DBA Masterclass Application Tuning
chrissaxon
0
3.2k
A Preview of Oracle Database 20c PLSQL Enhancements
chrissaxon
0
290
Why Is the Optimizer Estimating the Wrong Number of Rows?
chrissaxon
0
160
Which Indexes Should I Create?
chrissaxon
0
200
Other Decks in Technology
See All in Technology
Docker Desktop不要の時代が来る? WSL標準の「wslc」で Linuxコンテナを動かしてみた.
ueponx
0
910
AI Driven AI Governance
pict3
0
320
KiCAD講習会②
tutcreators
0
110
インフラと開発の垣根を超えていき!〜元AWSインフラエンジニアがAWS開発で奮闘している話〜
hatahata021
1
110
Kaggleで成長するために意識したこと
prgckwb
1
140
Claude Codeとハーネスについて考えてみる
oikon48
18
9.2k
プロンプト_きのこカンファレンス2026_LT
yurufuwahealer
0
150
Baseline対応のDOMの型定義を作った
uhyo
3
730
Foxgloveについて 実際にExtensionを開発して公開するまでの話 / About Foxglove: The Story of Developing and Releasing an Extension
ry0_ka
0
200
実装だけじゃない! CCA-F取得エンジニアが教えるClaude Code開発プロセス活用術
diggymo
2
510
AI時代の EM への処方箋
staka121
PRO
0
120
DatabricksにおけるMCPソリューション
taka_aki
1
210
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
24k
Building Adaptive Systems
keathley
44
3.1k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
Everyday Curiosity
cassininazir
0
250
Balancing Empowerment & Direction
lara
6
1.2k
The untapped power of vector embeddings
frankvandijk
2
1.8k
How to build a perfect <img>
jonoalderson
1
5.8k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
490
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
WCS-LA-2024
lcolladotor
0
680
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Transcript
Your SQL Office Hours session will begin soon… Tuning SQL
Date Range Queries Chris Saxon @ChrisRSaxon & @SQLDaily https://www.youtube.com/c/TheMagicofSQL https://blogs.oracle.com/sql
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
| Welcome to Ask TOM Office Hours!
Why is select … where col = 'VALUE' and date_value
between to_date ( :st_dt, 'YYYY-MM-DD' ) and to_date ( :en_dt, 'YYYY-MM-DD' ) fast for short date ranges and slooooow for large ones?
How many rows will select … where col = :bind_variable
return? # rows / # distinct or use histogram
How many rows will select … where date_value between to_date
( :st_dt, 'YYYY-MM-DD' ) and to_date ( :en_dt, 'YYYY-MM-DD' ) return? ¯\_(ツ)_/¯
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
| Look at the bind values! (peek)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
| DEMO
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
| • One query may have many "good plans" • The database spots this with adaptive cursor sharing • Dynamic statistics can help improve estimates further • Adaptive plans (12c) can change join type (NL <> HJ) Summary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
| asktom.oracle.com #MakeDataGreatAgain Ryan McGuire / Gratisography