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
0
260
Tuning SQL Date Range Queries
Chris
November 01, 2019
Tweet
Share
More Decks by Chris
See All by Chris
Create reusable SQL expressions with SQL macros
chrissaxon
0
94
All About Insert
chrissaxon
0
170
Generating days between two dates
chrissaxon
0
200
Converting rows to columns and back again
chrissaxon
0
190
Finding the Longest Common Substring & Gestalt Pattern Matching with SQL & PL/SQL
chrissaxon
0
620
DBA Masterclass Application Tuning
chrissaxon
0
3.1k
A Preview of Oracle Database 20c PLSQL Enhancements
chrissaxon
0
250
Why Is the Optimizer Estimating the Wrong Number of Rows?
chrissaxon
0
110
Which Indexes Should I Create?
chrissaxon
0
160
Other Decks in Technology
See All in Technology
JavaScript 研修
recruitengineers
PRO
2
170
microCMS 最新リリース情報(microCMS Meetup 2025)
microcms
0
110
KiroでGameDay開催してみよう(準備編)
yuuuuuuu168
1
130
モバイルアプリ研修
recruitengineers
PRO
2
250
生成AI利用プログラミング:誰でもプログラムが書けると 世の中どうなる?/opencampus202508
okana2ki
0
190
Product Management Conference -AI時代に進化するPdM-
kojima111
0
220
モダンな現場と従来型の組織——そこに生じる "不整合" を解消してこそチームがパフォーマンスを発揮できる / Team-oriented Organization Design 20250825
mtx2s
5
540
小さなチーム 大きな仕事 - 個人開発でAIをフル活用する
himaratsu
0
120
Goss: New Production-Ready Go Binding for Faiss #coefl_go_jp
bengo4com
0
1.1k
Gaze-LLE: Gaze Target Estimation via Large-Scale Learned Encoders
kzykmyzw
0
320
ソフトウェア エンジニアとしての 姿勢と心構え
recruitengineers
PRO
3
740
Browser
recruitengineers
PRO
3
320
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Designing for humans not robots
tammielis
253
25k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Docker and Python
trallard
45
3.5k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
What's in a price? How to price your products and services
michaelherold
246
12k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
The Language of Interfaces
destraynor
160
25k
Faster Mobile Websites
deanohume
309
31k
Visualization
eitanlees
147
16k
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