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
210
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
35
All About Insert
chrissaxon
0
130
Generating days between two dates
chrissaxon
0
140
Converting rows to columns and back again
chrissaxon
0
150
Finding the Longest Common Substring & Gestalt Pattern Matching with SQL & PL/SQL
chrissaxon
0
410
DBA Masterclass Application Tuning
chrissaxon
0
3k
A Preview of Oracle Database 20c PLSQL Enhancements
chrissaxon
0
180
Why Is the Optimizer Estimating the Wrong Number of Rows?
chrissaxon
0
66
Which Indexes Should I Create?
chrissaxon
0
120
Other Decks in Technology
See All in Technology
MLOpsの「壁」を乗り越える、LINEヤフーの Data Quality as Code
lycorptech_jp
PRO
5
430
複雑な構成要素を持つUIとの向き合い方 〜新・支出グラフでの実例〜 / B43 TECH TALK
nakamuuu
0
140
よく聞くけど使ったことないソフトウェアNo.1 KafkaとSnowflake
foursue
4
340
「スニダン」開発組織の構造に込めた意図 ~組織作りはパッションや政治ではない!~
rinchsan
3
530
一生覚えておきたい「システム開発=コミュニケーション」〜初めての実務案件振り返りLT〜
maimyyym
0
110
非同期推論システムによるコスト削減と信頼性向上
koki_nishihara
0
180
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
2k
オーナーシップを持つ領域を明確にする
konifar
13
3.1k
Kernel MemoryでAzure OpenAI Serviceとお手軽データソース連携
mitsuzono
1
230
Postman v10リリース後を振り返る / Looking back at Postman v10 after release
yokawasa
1
150
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
160
元インフラエンジニアに成る / Human Resources to Human Relations
bobtani
4
900
Featured
See All Featured
Happy Clients
brianwarren
92
6.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
GitHub's CSS Performance
jonrohan
1025
450k
Building an army of robots
kneath
300
41k
Agile that works and the tools we love
rasmusluckow
325
20k
Writing Fast Ruby
sferik
621
60k
Unsuck your backbone
ammeep
663
57k
RailsConf 2023
tenderlove
4
540
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
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