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
Chris
November 01, 2019
Technology
270
0
Share
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
140
All About Insert
chrissaxon
0
190
Generating days between two dates
chrissaxon
0
250
Converting rows to columns and back again
chrissaxon
0
220
Finding the Longest Common Substring & Gestalt Pattern Matching with SQL & PL/SQL
chrissaxon
0
710
DBA Masterclass Application Tuning
chrissaxon
0
3.2k
A Preview of Oracle Database 20c PLSQL Enhancements
chrissaxon
0
280
Why Is the Optimizer Estimating the Wrong Number of Rows?
chrissaxon
0
150
Which Indexes Should I Create?
chrissaxon
0
190
Other Decks in Technology
See All in Technology
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
4.5k
最新技術を"今は選ばない"という技術選定
leveragestech
PRO
0
360
データ分析基盤の信頼を支える視点と設計
yuki_saito
1
370
TSKaigi 2026 - Auth.jsからBetter Authへの 移行に見る「型とランタイム」の 設計思想の変化
teamlab
PRO
1
100
Slack MCPでインシデント対応とFAQ生成を加速する:社内ワークショップの実践
lycorptech_jp
PRO
0
120
Claude Code x Accounting
kawaguti
PRO
0
210
SDDで⾒える、AIコーディングの"内訳"
lycorptech_jp
PRO
0
150
React Compiler導入の効果と運用の工夫
kakehashi
PRO
3
310
コーディングAIが導くリスクベースド探索的テストの実践
lycorptech_jp
PRO
1
140
TypeScriptとAngular Signal で実現する保守性の高いアプリケーション設計 - 3層アーキテクチャによる責務分離の実践(たつかわ) https://2026.tskaigi.org/talks/10
nealle
1
150
TypeScriptはどのようにどこまで推論できるのか ─ とにかく as は禁止で
ypresto
1
290
JaSSTに関わることで変わった人生観 #jasstnano
makky_tyuyan
0
170
Featured
See All Featured
Being A Developer After 40
akosma
91
590k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Agile that works and the tools we love
rasmusluckow
331
21k
Rails Girls Zürich Keynote
gr2m
96
14k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Code Review Best Practice
trishagee
74
20k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
390
Unsuck your backbone
ammeep
672
58k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
140
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Statistics for Hackers
jakevdp
799
230k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
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