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
110
All About Insert
chrissaxon
0
180
Generating days between two dates
chrissaxon
0
230
Converting rows to columns and back again
chrissaxon
0
210
Finding the Longest Common Substring & Gestalt Pattern Matching with SQL & PL/SQL
chrissaxon
0
680
DBA Masterclass Application Tuning
chrissaxon
0
3.1k
A Preview of Oracle Database 20c PLSQL Enhancements
chrissaxon
0
270
Why Is the Optimizer Estimating the Wrong Number of Rows?
chrissaxon
0
140
Which Indexes Should I Create?
chrissaxon
0
180
Other Decks in Technology
See All in Technology
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
340
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
530
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
330
What happened to RubyGems and what can we learn?
mikemcquaid
0
240
AI時代、1年目エンジニアの悩み
jin4
1
160
あたらしい上流工程の形。 0日導入からはじめるAI駆動PM
kumaiu
5
750
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
150
SREのプラクティスを用いた3領域同時 マネジメントへの挑戦 〜SRE・情シス・セキュリティを統合した チーム運営術〜
coconala_engineer
2
580
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.5k
Meshy Proプラン課金した
henjin0
0
240
CDKで始めるTypeScript開発のススメ
tsukuboshi
1
310
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
4 Signs Your Business is Dying
shpigford
187
22k
Mind Mapping
helmedeiros
PRO
0
75
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
90
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
240
How to make the Groovebox
asonas
2
1.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
250
How to Talk to Developers About Accessibility
jct
2
130
Utilizing Notion as your number one productivity tool
mfonobong
2
210
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
120
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