SlideShare uma empresa Scribd logo
1 de 58
zen and the art of SQL optimization Karen Morton
 
 
Simplicity
“ Make everything as simple as possible but no simpler. ” ,[object Object]
 
 
“ Normally, we do not so much look at things as   overlook them.” ,[object Object]
simple vs simple-minded
Oracle 9.2.0.6 SELECT to_char(   to_date(:B1,‘DD-MON-YYYY’)+1,   ‘DD-MON-YYYY’ )   FROM dual;
What about its effect?
32.9% % of total R
1,087,770 # of executions
3,263,033 # of LIOs
v_date_str :=  to_char(   to_date( :B1,‘DD-MON-YYYY’ ) + 1,   ‘ DD-MON-YYYY’ ) ;
Focus
ETCIBMVIPNASAFBI
ETC IBM VIP NASA FBI
SELECT rowid, load_no, load_status, manifest_no, manifest_date FROM cs_loads  WHERE load_no = 552888 ; VARCHAR2(15) SELECT rowid, load_no, load_status, manifest_no, manifest_date FROM cs_loads  WHERE  load_no = 552888  ; datatype mismatch causes FULL SCAN SELECT rowid, load_no, load_status, manifest_no, manifest_date FROM cs_loads  WHERE load_no =‘552888’;
SELECT rowid, load_no, load_status, manifest_no, manifest_date FROM cs_loads  WHERE load_no = :B1 ;
Keys to Optimizing SQL
Tune the question, not the query.
What output should the query provide?
What special conditions need to be handled?
“ If you don’t know where you are going, you’ll end up somewhere else.” ,[object Object]
Reduce. Reuse.
Decrease row source sizes quickly
Access objects once and reuse the result set
“ Not enough gets said about the importance of abandoning crap.”   - Ira Glass
Practice.
Never stop learning
Stay connected
Think in sets
Test Test Test (then test again)
 
“ Practice, practice, practice. Until it becomes your practice.” ,[object Object]
Going Zen
[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
Simplicity is powerful…
… but it is neither simple nor easy to achieve.
It is obtained  through the careful reduction of the nonessential.
While simplicity is the goal…
… it is possible to be “too simple.”
Your job is to find the balance most appropriate to your situation.
Thank You
http://www.method-r.com http://karenmorton.blogspot.com [email_address]

Mais conteúdo relacionado

Mais procurados

Ramco C Question Paper 2003
Ramco  C  Question  Paper 2003Ramco  C  Question  Paper 2003
Ramco C Question Paper 2003
ncct
 
mysql 高级优化之 理解索引使用
mysql 高级优化之 理解索引使用mysql 高级优化之 理解索引使用
mysql 高级优化之 理解索引使用
nigel889
 

Mais procurados (20)

Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest Features
 
List intersection for web search: Algorithms, Cost Models, and Optimizations
List intersection for web search: Algorithms, Cost Models, and OptimizationsList intersection for web search: Algorithms, Cost Models, and Optimizations
List intersection for web search: Algorithms, Cost Models, and Optimizations
 
Ramco C Question Paper 2003
Ramco  C  Question  Paper 2003Ramco  C  Question  Paper 2003
Ramco C Question Paper 2003
 
4th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
4th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...4th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
4th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
 
AST: threats and opportunities
AST: threats and opportunitiesAST: threats and opportunities
AST: threats and opportunities
 
Fine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFELFine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFEL
 
The Five Best Things To Happen To SQL
The Five Best Things To Happen To SQLThe Five Best Things To Happen To SQL
The Five Best Things To Happen To SQL
 
3rd Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
3rd Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...3rd Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
3rd Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
 
mysql 高级优化之 理解索引使用
mysql 高级优化之 理解索引使用mysql 高级优化之 理解索引使用
mysql 高级优化之 理解索引使用
 
5. Destructuring | ES6 | Assignment
5. Destructuring | ES6 | Assignment 5. Destructuring | ES6 | Assignment
5. Destructuring | ES6 | Assignment
 
FØCAL Boston AiR - Computer Vision Tracing and Hardware Simulation
FØCAL Boston AiR - Computer Vision Tracing and Hardware SimulationFØCAL Boston AiR - Computer Vision Tracing and Hardware Simulation
FØCAL Boston AiR - Computer Vision Tracing and Hardware Simulation
 
5th Semester Mechanical Engineering (2013-June) Question Papers
5th Semester Mechanical Engineering (2013-June) Question Papers 5th Semester Mechanical Engineering (2013-June) Question Papers
5th Semester Mechanical Engineering (2013-June) Question Papers
 
Elixir @ Paris.rb
Elixir @ Paris.rbElixir @ Paris.rb
Elixir @ Paris.rb
 
Merge sort
Merge sortMerge sort
Merge sort
 
4th Semester M Tech: VLSI Design and Embedded System (June-2016) Question Papers
4th Semester M Tech: VLSI Design and Embedded System (June-2016) Question Papers4th Semester M Tech: VLSI Design and Embedded System (June-2016) Question Papers
4th Semester M Tech: VLSI Design and Embedded System (June-2016) Question Papers
 
8th Semester (June; July-2014) Mechanical Engineering Question Papers
8th Semester (June; July-2014) Mechanical Engineering Question Papers8th Semester (June; July-2014) Mechanical Engineering Question Papers
8th Semester (June; July-2014) Mechanical Engineering Question Papers
 
5th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
5th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...5th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
5th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
 
Machine Learning Model Bakeoff
Machine Learning Model BakeoffMachine Learning Model Bakeoff
Machine Learning Model Bakeoff
 
8th Semester Mechanical Engineering (June/July-2015) Question Papers
8th Semester Mechanical Engineering  (June/July-2015) Question Papers8th Semester Mechanical Engineering  (June/July-2015) Question Papers
8th Semester Mechanical Engineering (June/July-2015) Question Papers
 

Destaque

Introduction Presentation for LinkedUp kickoff meeting
Introduction Presentation for LinkedUp kickoff meetingIntroduction Presentation for LinkedUp kickoff meeting
Introduction Presentation for LinkedUp kickoff meeting
Hendrik Drachsler
 
Product Development at the Smithsonian Libraries
Product Development at the Smithsonian LibrariesProduct Development at the Smithsonian Libraries
Product Development at the Smithsonian Libraries
eclemrush
 
LinkedUp kickoff meeting session 4
LinkedUp kickoff meeting session 4LinkedUp kickoff meeting session 4
LinkedUp kickoff meeting session 4
Hendrik Drachsler
 
コミュニケーションソフトウェアを創るということ
コミュニケーションソフトウェアを創るということコミュニケーションソフトウェアを創るということ
コミュニケーションソフトウェアを創るということ
Kazuho Oku
 
Gauteng Freeways
Gauteng FreewaysGauteng Freeways
Gauteng Freeways
guest85be6a
 
Garter Snake by A.J.Delorme
Garter Snake by A.J.DelormeGarter Snake by A.J.Delorme
Garter Snake by A.J.Delorme
vebrya
 

Destaque (20)

London magento
London magentoLondon magento
London magento
 
Introduction Presentation for LinkedUp kickoff meeting
Introduction Presentation for LinkedUp kickoff meetingIntroduction Presentation for LinkedUp kickoff meeting
Introduction Presentation for LinkedUp kickoff meeting
 
Do dodane vrednosti s Twitterjem in drugimi socialnimi orodji
Do dodane vrednosti s Twitterjem in drugimi socialnimi orodjiDo dodane vrednosti s Twitterjem in drugimi socialnimi orodji
Do dodane vrednosti s Twitterjem in drugimi socialnimi orodji
 
Workplace etiquettes
Workplace etiquettesWorkplace etiquettes
Workplace etiquettes
 
Analisis crítico del texto
Analisis crítico del textoAnalisis crítico del texto
Analisis crítico del texto
 
Mwomen
MwomenMwomen
Mwomen
 
Youth Campaigns & Social Media - Oct 2008
Youth Campaigns & Social Media -  Oct 2008Youth Campaigns & Social Media -  Oct 2008
Youth Campaigns & Social Media - Oct 2008
 
Product Development at the Smithsonian Libraries
Product Development at the Smithsonian LibrariesProduct Development at the Smithsonian Libraries
Product Development at the Smithsonian Libraries
 
LinkedUp kickoff meeting session 4
LinkedUp kickoff meeting session 4LinkedUp kickoff meeting session 4
LinkedUp kickoff meeting session 4
 
Open Science
Open ScienceOpen Science
Open Science
 
Data Sets as Facilitator for new Products and Services for Universities
Data Sets as Facilitator for new Products and Services for UniversitiesData Sets as Facilitator for new Products and Services for Universities
Data Sets as Facilitator for new Products and Services for Universities
 
Anh Chuyen ve Chua Hai Dong Giesu
Anh Chuyen ve Chua Hai Dong GiesuAnh Chuyen ve Chua Hai Dong Giesu
Anh Chuyen ve Chua Hai Dong Giesu
 
Inbound Marketing Explained
Inbound Marketing ExplainedInbound Marketing Explained
Inbound Marketing Explained
 
Jisc RSC Wales ISS 260213
Jisc RSC Wales ISS 260213Jisc RSC Wales ISS 260213
Jisc RSC Wales ISS 260213
 
'Fotografia privata' su Web: microstorie del Novecento
'Fotografia privata' su Web: microstorie del Novecento'Fotografia privata' su Web: microstorie del Novecento
'Fotografia privata' su Web: microstorie del Novecento
 
コミュニケーションソフトウェアを創るということ
コミュニケーションソフトウェアを創るということコミュニケーションソフトウェアを創るということ
コミュニケーションソフトウェアを創るということ
 
Gauteng Freeways
Gauteng FreewaysGauteng Freeways
Gauteng Freeways
 
The Diy Marketers Guide To A Magnetic Marketing
The Diy Marketers  Guide To A Magnetic MarketingThe Diy Marketers  Guide To A Magnetic Marketing
The Diy Marketers Guide To A Magnetic Marketing
 
Garter Snake by A.J.Delorme
Garter Snake by A.J.DelormeGarter Snake by A.J.Delorme
Garter Snake by A.J.Delorme
 
Collecting and utilizing assessment information
Collecting and utilizing assessment informationCollecting and utilizing assessment information
Collecting and utilizing assessment information
 

Semelhante a zen and the art of SQL optimization

Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdfDatabase & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
InSync2011
 
Postgres performance for humans
Postgres performance for humansPostgres performance for humans
Postgres performance for humans
Craig Kerstiens
 
Formal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractFormal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction Contract
Gera Shegalov
 

Semelhante a zen and the art of SQL optimization (20)

Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdfDatabase & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
 
Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application Development
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer Disasters
 
New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
 
Loopback.vhd
Loopback.vhdLoopback.vhd
Loopback.vhd
 
A few things about the Oracle optimizer - 2013
A few things about the Oracle optimizer - 2013A few things about the Oracle optimizer - 2013
A few things about the Oracle optimizer - 2013
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
 
Show innodb status
Show innodb statusShow innodb status
Show innodb status
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
 
Postgres performance for humans
Postgres performance for humansPostgres performance for humans
Postgres performance for humans
 
Oracle trace data collection errors: the story about oceans, islands, and rivers
Oracle trace data collection errors: the story about oceans, islands, and riversOracle trace data collection errors: the story about oceans, islands, and rivers
Oracle trace data collection errors: the story about oceans, islands, and rivers
 
Formal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractFormal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction Contract
 
How to tune a query - ODTUG 2012
How to tune a query - ODTUG 2012How to tune a query - ODTUG 2012
How to tune a query - ODTUG 2012
 
Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolest
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
 
SQLQueries
SQLQueriesSQLQueries
SQLQueries
 

Mais de Karen Morton

Managing SQL Performance
Managing SQL PerformanceManaging SQL Performance
Managing SQL Performance
Karen Morton
 

Mais de Karen Morton (6)

Managing SQL Performance
Managing SQL PerformanceManaging SQL Performance
Managing SQL Performance
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 
The Oracle Advisors from a Different Perspective
The Oracle Advisors from a Different PerspectiveThe Oracle Advisors from a Different Perspective
The Oracle Advisors from a Different Perspective
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 
Performance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, HowPerformance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, How
 
Are you a monkey or an astronaut?
Are you a monkey or an astronaut?Are you a monkey or an astronaut?
Are you a monkey or an astronaut?
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

zen and the art of SQL optimization