SlideShare a Scribd company logo
Writing Optimal Queries
Things to Consider
• Using Functions in Queries
• Implicit Conversions/Data Type Mismatch
• Missing Join Predicates, Missing Column Statistics
• Clustered GUID’s
• Remember - Row goal issue
Things to Consider contd..
• SQL Anti Patterns
• Temp Table vs Table Variable
• Avoid using HAVING when its possible to use WHERE
• Issues with Multiple Distinct Aggregates.
Introduction
• Sourabh Agarwal
• Premier Field Engineer – Microsoft Services
• Blogs: www.sqluninterrupted.com
• Facebook: www.facebook.comtroubleshootingsql,
www.facebook.comsqlserverfaq,
https://www.facebook.com/groups/SQLBangalore/?ref=bookmarks
• Twitter: @SQLSourabh
Writing optimal queries

More Related Content

PPSX
OutSystems community meetup 2018 11 reusable ui components
Kurt Vandevelde
 
PPTX
Geb: Abstracting Page Templates
Josh Hamit
 
PPTX
Indexing basics
Sourabh Agarwal
 
PPTX
Sql azure bcdr_dp_talks_session
Sourabh Agarwal
 
PPTX
Optimizing your backup
Sourabh Agarwal
 
PDF
Youth programs provide a future for the sport
United States Bowling Congress
 
PPTX
Geek Sync | SQL Server Indexing Basics
IDERA Software
 
PPTX
Advanced Index, Partitioning and Compression Strategies for SQL Server
Confio Software
 
OutSystems community meetup 2018 11 reusable ui components
Kurt Vandevelde
 
Geb: Abstracting Page Templates
Josh Hamit
 
Indexing basics
Sourabh Agarwal
 
Sql azure bcdr_dp_talks_session
Sourabh Agarwal
 
Optimizing your backup
Sourabh Agarwal
 
Youth programs provide a future for the sport
United States Bowling Congress
 
Geek Sync | SQL Server Indexing Basics
IDERA Software
 
Advanced Index, Partitioning and Compression Strategies for SQL Server
Confio Software
 

Viewers also liked (10)

PPTX
SQL Saturday 511 - Troubleshooting made easier using extended events
Amit Banerjee
 
PDF
5 SQL Server Indexing Myths
Jason Strate
 
PDF
PostgreSQL: Advanced indexing
Hans-Jürgen Schönig
 
PPTX
Database index
Riteshkiit
 
PPTX
Introduction of sql server indexing
Mahabubur Rahaman
 
PPTX
How did you use media technologies in the construction and research, planning...
Connor Ellis
 
PPTX
Database index(sql server)
Aaron King
 
PDF
SQL Server 2016 SSRS and BI
MSDEVMTL
 
PPT
Indexing
Ime Amor Mortel
 
SQL Saturday 511 - Troubleshooting made easier using extended events
Amit Banerjee
 
5 SQL Server Indexing Myths
Jason Strate
 
PostgreSQL: Advanced indexing
Hans-Jürgen Schönig
 
Database index
Riteshkiit
 
Introduction of sql server indexing
Mahabubur Rahaman
 
How did you use media technologies in the construction and research, planning...
Connor Ellis
 
Database index(sql server)
Aaron King
 
SQL Server 2016 SSRS and BI
MSDEVMTL
 
Indexing
Ime Amor Mortel
 
Ad

Recently uploaded (20)

PPTX
Economic Sector Performance Recovery.pptx
yulisbaso2020
 
PPTX
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
PDF
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
PDF
Technical Writing Module-I Complete Notes.pdf
VedprakashArya13
 
PDF
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
PPTX
Introduction-to-Python-Programming-Language (1).pptx
dhyeysapariya
 
PPTX
Measurement of Afordability for Water Supply and Sanitation in Bangladesh .pptx
akmibrahimbd
 
PDF
A Systems Thinking Approach to Algorithmic Fairness.pdf
Epistamai
 
PDF
Classifcation using Machine Learning and deep learning
bhaveshagrawal35
 
PPTX
Data Security Breach: Immediate Action Plan
varmabhuvan266
 
PPTX
Blue and Dark Blue Modern Technology Presentation.pptx
ap177979
 
PDF
oop_java (1) of ice or cse or eee ic.pdf
sabiquntoufiqlabonno
 
PDF
Chad Readey - An Independent Thinker
Chad Readey
 
PDF
Linux OS guide to know, operate. Linux Filesystem, command, users and system
Kiran Maharjan
 
PPTX
lecture 13 mind test academy it skills.pptx
ggesjmrasoolpark
 
PPTX
Databricks-DE-Associate Certification Questions-june-2024.pptx
pedelli41
 
PPT
Grade 5 PPT_Science_Q2_W6_Methods of reproduction.ppt
AaronBaluyut
 
PPTX
Pipeline Automatic Leak Detection for Water Distribution Systems
Sione Palu
 
PDF
The_Future_of_Data_Analytics_by_CA_Suvidha_Chaplot_UPDATED.pdf
CA Suvidha Chaplot
 
PPTX
World-population.pptx fire bunberbpeople
umutunsalnsl4402
 
Economic Sector Performance Recovery.pptx
yulisbaso2020
 
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
Technical Writing Module-I Complete Notes.pdf
VedprakashArya13
 
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
Introduction-to-Python-Programming-Language (1).pptx
dhyeysapariya
 
Measurement of Afordability for Water Supply and Sanitation in Bangladesh .pptx
akmibrahimbd
 
A Systems Thinking Approach to Algorithmic Fairness.pdf
Epistamai
 
Classifcation using Machine Learning and deep learning
bhaveshagrawal35
 
Data Security Breach: Immediate Action Plan
varmabhuvan266
 
Blue and Dark Blue Modern Technology Presentation.pptx
ap177979
 
oop_java (1) of ice or cse or eee ic.pdf
sabiquntoufiqlabonno
 
Chad Readey - An Independent Thinker
Chad Readey
 
Linux OS guide to know, operate. Linux Filesystem, command, users and system
Kiran Maharjan
 
lecture 13 mind test academy it skills.pptx
ggesjmrasoolpark
 
Databricks-DE-Associate Certification Questions-june-2024.pptx
pedelli41
 
Grade 5 PPT_Science_Q2_W6_Methods of reproduction.ppt
AaronBaluyut
 
Pipeline Automatic Leak Detection for Water Distribution Systems
Sione Palu
 
The_Future_of_Data_Analytics_by_CA_Suvidha_Chaplot_UPDATED.pdf
CA Suvidha Chaplot
 
World-population.pptx fire bunberbpeople
umutunsalnsl4402
 
Ad

Writing optimal queries

  • 2. Things to Consider • Using Functions in Queries • Implicit Conversions/Data Type Mismatch • Missing Join Predicates, Missing Column Statistics • Clustered GUID’s • Remember - Row goal issue
  • 3. Things to Consider contd.. • SQL Anti Patterns • Temp Table vs Table Variable • Avoid using HAVING when its possible to use WHERE • Issues with Multiple Distinct Aggregates.
  • 4. Introduction • Sourabh Agarwal • Premier Field Engineer – Microsoft Services • Blogs: www.sqluninterrupted.com • Facebook: www.facebook.comtroubleshootingsql, www.facebook.comsqlserverfaq, https://www.facebook.com/groups/SQLBangalore/?ref=bookmarks • Twitter: @SQLSourabh