SlideShare a Scribd company logo
Inside
SQL Server Optimizer
By Hamid Jabarpour Fard
 Hamid Jabarpour Fard
 Consultant / Author / Trainer / Speaker
 Data Platform Specialist, Fard Solutions Sdn. Bhd.
 Email: Hamid@Fard-Solutions.com
 Website: http://www.Fard-Solutions.com
Agenda
 Optimizer Limitations with Filtered Indexes
 Forcing a Parallel Query Execution Plan
 Statistics on Ascending Columns
 Questions and Answers
 15 Minutes Break
Optimizer Limitations with Filtered Indexes
Demo
Optimizer Limitations with Filtered Indexes
 Conclusion
 Redundant join predicates can be necessary to match
filtered indexes.
 Filtered unique indexes do not provide uniqueness
information to the optimizer.
 In some cases it may be practical to simply add the
redundant predicates to every query.
Forcing a Parallel Query Execution Plan
Demo
Forcing a Parallel Query Execution Plan
 Conclusion
 Below actions make serial plan in SQL Server
 Table variable’s content modification.
 Any T-SQL scalar function.
 CLR scalar functions marked as performing data access.
 Random intrinsic functions including
OBJECT_NAME, ENCRYPTBYCERT and IDENT_CURRENT.
 System table access. (e.g. sys.tables)
 TOP
 Sequence Project (e.g. ROW_NUMBER, RANK)
 Recursive CTEs
Forcing a Parallel Query Execution Plan (Cont.)
 Conclusion
 Even experts with decades of SQL Server experience and
detailed internal knowledge will want to be careful with
trace 8649 flag.
Statistics on Ascending Columns
Demo
Statistics on Ascending Columns
 Conclusion
 This is just an alternative way to fix a problem that is seen
with large tables with ascending columns.
 The best solution is to update statistics periodically.
 Trace flag 2389 will work only for columns branded as
ascending.
 Trace flag 2390 does not make sense to do so because it
will stop working when the column turns out to be
ascending.
Questions and Answers
Thanks For Attending
This Event.

More Related Content

PPTX
SQL Server Backup and Recovery Challenges
PPTX
SQL Server Database Backup and Restore Plan
PPTX
Backup and recovery in sql server database
PPT
Database backup & recovery
PPT
Database backup and recovery basics
PPTX
Performance tuning and optimization on client server
SQL Server Backup and Recovery Challenges
SQL Server Database Backup and Restore Plan
Backup and recovery in sql server database
Database backup & recovery
Database backup and recovery basics
Performance tuning and optimization on client server

What's hot (7)

PPTX
SQL Server 2008 R2 - Implementing High Availabilitty
PDF
Database backup and recovery
PPT
Bi Capacity Planning
PDF
Database Administrator: Job Description, Salary and Future Scope
PDF
It best practices
PPTX
Online Reporting Architectures Behind Load Balancers
PPT
Database administrator: job description, salary and future scope
SQL Server 2008 R2 - Implementing High Availabilitty
Database backup and recovery
Bi Capacity Planning
Database Administrator: Job Description, Salary and Future Scope
It best practices
Online Reporting Architectures Behind Load Balancers
Database administrator: job description, salary and future scope
Ad

Similar to SQL Server - Inside Optimizer Engine (17)

PDF
Modernizing your database with SQL Server 2019
PPTX
05_DP_300T00A_Optimize.pptx
PPTX
Geek Sync | Performance Tune Like an MVP
PDF
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
PDF
Gems to help you troubleshoot query performance
PDF
SqlDay 2018 - Brief introduction into SQL Server Execution Plans
PDF
Exploring T-SQL Anti-Patterns
PDF
Inside the sql server query optimizer
PDF
Brad McGehee Intepreting Execution Plans Mar09
PDF
Brad McGehee Intepreting Execution Plans Mar09
PPTX
Introduction to SQL Server Internals: How to Think Like the Engine
PPTX
How to think like the engine
PDF
Statistics and Indexes Internals
PPTX
Sql server enterprise edition awareness
PDF
Chasing the optimizer
PDF
SQL Server 2019 ctp2.2
PPTX
Query Optimization & How to interpret query execution plan
Modernizing your database with SQL Server 2019
05_DP_300T00A_Optimize.pptx
Geek Sync | Performance Tune Like an MVP
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
Gems to help you troubleshoot query performance
SqlDay 2018 - Brief introduction into SQL Server Execution Plans
Exploring T-SQL Anti-Patterns
Inside the sql server query optimizer
Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09
Introduction to SQL Server Internals: How to Think Like the Engine
How to think like the engine
Statistics and Indexes Internals
Sql server enterprise edition awareness
Chasing the optimizer
SQL Server 2019 ctp2.2
Query Optimization & How to interpret query execution plan
Ad

More from Hamid J. Fard (10)

PPTX
Sql server backup internals
PDF
SQL Server High Availability Solutions (Pros & Cons)
PPTX
SQL Server Memory Pressure
PPTX
SQL Server In-Memory Internals and Performance Tips
PPTX
Fard Solutions Sdn Bhd
PDF
Data Platform Overview
PDF
SQL Server 2016 Everything built-in FULL deck
PPTX
SQL Server Security And Encryption
PPTX
SQL Server Index and Partition Strategy
PPTX
SQL Saturday #438
Sql server backup internals
SQL Server High Availability Solutions (Pros & Cons)
SQL Server Memory Pressure
SQL Server In-Memory Internals and Performance Tips
Fard Solutions Sdn Bhd
Data Platform Overview
SQL Server 2016 Everything built-in FULL deck
SQL Server Security And Encryption
SQL Server Index and Partition Strategy
SQL Saturday #438

Recently uploaded (20)

PPTX
Supervised vs unsupervised machine learning algorithms
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Introduction to Business Data Analytics.
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PPTX
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
Global journeys: estimating international migration
PPTX
Introduction to Knowledge Engineering Part 1
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Supervised vs unsupervised machine learning algorithms
Miokarditis (Inflamasi pada Otot Jantung)
Clinical guidelines as a resource for EBP(1).pdf
climate analysis of Dhaka ,Banglades.pptx
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
Reliability_Chapter_ presentation 1221.5784
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Introduction to Business Data Analytics.
Fluorescence-microscope_Botany_detailed content
IBA_Chapter_11_Slides_Final_Accessible.pptx
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
Introduction-to-Cloud-ComputingFinal.pptx
.pdf is not working space design for the following data for the following dat...
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Global journeys: estimating international migration
Introduction to Knowledge Engineering Part 1
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf

SQL Server - Inside Optimizer Engine

  • 1. Inside SQL Server Optimizer By Hamid Jabarpour Fard
  • 2.  Hamid Jabarpour Fard  Consultant / Author / Trainer / Speaker  Data Platform Specialist, Fard Solutions Sdn. Bhd.  Email: Hamid@Fard-Solutions.com  Website: http://www.Fard-Solutions.com
  • 3. Agenda  Optimizer Limitations with Filtered Indexes  Forcing a Parallel Query Execution Plan  Statistics on Ascending Columns  Questions and Answers  15 Minutes Break
  • 4. Optimizer Limitations with Filtered Indexes Demo
  • 5. Optimizer Limitations with Filtered Indexes  Conclusion  Redundant join predicates can be necessary to match filtered indexes.  Filtered unique indexes do not provide uniqueness information to the optimizer.  In some cases it may be practical to simply add the redundant predicates to every query.
  • 6. Forcing a Parallel Query Execution Plan Demo
  • 7. Forcing a Parallel Query Execution Plan  Conclusion  Below actions make serial plan in SQL Server  Table variable’s content modification.  Any T-SQL scalar function.  CLR scalar functions marked as performing data access.  Random intrinsic functions including OBJECT_NAME, ENCRYPTBYCERT and IDENT_CURRENT.  System table access. (e.g. sys.tables)  TOP  Sequence Project (e.g. ROW_NUMBER, RANK)  Recursive CTEs
  • 8. Forcing a Parallel Query Execution Plan (Cont.)  Conclusion  Even experts with decades of SQL Server experience and detailed internal knowledge will want to be careful with trace 8649 flag.
  • 9. Statistics on Ascending Columns Demo
  • 10. Statistics on Ascending Columns  Conclusion  This is just an alternative way to fix a problem that is seen with large tables with ascending columns.  The best solution is to update statistics periodically.  Trace flag 2389 will work only for columns branded as ascending.  Trace flag 2390 does not make sense to do so because it will stop working when the column turns out to be ascending.