SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Execution plans in practice – how to
make SQL Server queries faster
Damian Widera
Microsoft Data Platform MVP
EUVIC
@damianwidera
http://sqlblog.com/blogs/damian_widera/default.aspx
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Many thanks to our sponsors & partners!
GOLD
SILVER
PARTNERS
PLATINUM
POWERED BY
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Come to Poland on October 1st!
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Damian Widera
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
EUVIC
PALO ALTO
NOWY JORK
WARSZAWA
KATOWICE
GLIWICE
BIELSKO BIAŁA
WROCŁAW
CZĘSTOCHOWA
GDYNIA
KRAKÓW
BYDGOSZCZ
WIEDEŃ
BIAŁYSTOK
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Customers…
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
• What is bad in terms of query execution
• What was bad in previous examples is not always
bad…
• SQL Server 2016 – how could it help?
Today I am going to tell about….
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
SQL Server School of Art
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
• A query takes long time to execute
• A query consumes too much resources
• Then we have:
–Reduced concurency
–More locks that should be
• Locks contentions, waits, etc…
What is bad in terms of query execution
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
• A query (logical) is parsed and optimized based on
all available information (cost optimization)
• Estimation != Guestimation
• Plan(s) is (are) produced
How it works
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Bad row estimates can impact a variety of decisions
including:
• index selection seek vs. scan operations,
• parallel versus serial execution,
• join algorithm selection,
• inner vs. outer physical join selection (e.g. build vs.
probe),
• spool generation,
• bookmark lookups vs. full clustered or heap table access,
• stream or hash aggregate selection
Why it is so important?
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
• Index or table scans (*): May indicate a need
for better or additional indexes (*)
– THIS IS NOT ALWAYS WRONG!!!!
• Bookmark Lookups: Consider changing the current
clustered index, consider using a covering index, limit the
number of columns in the SELECT statement.
• Filter: Remove any functions in the WHERE clause, don’t
include views in your Transact-SQL code, may need
additional indexes.
What to look for…
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
• Sort: Does the data really need to be sorted? Can an index
be used to avoid sorting? Can sorting be done at the
client more efficiently? „Hidden” sort. Nonlinear
operation
• Spool. Used as a cache in the QP. Reason – lack of indexes
or uniqueness. Implemented as a hidden tables in tempdb
• Hash. Used for joins and aggregations. Builds a hashtable
in memory (or in tempdb). Means there is no good index.
What to look for…
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
• When index scan is the best option
–Two examples
• High density -> Seek
• Low density -> Scan
• When cursor can be the best option (especially for
SQL Server 2008 R2 and older)
–Running total
What was bad in previous example is not always bad…
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
New functionality that makes DBAs’ happy - Query
Store
will be available in all editions
SQL Server 2016 – how could it help?
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Query data store
Durability latency controlled by DB option
DATA_FLUSH_INTERNAL_SECONDS
Compile
Execute
Plan store
Runtime stats
Query Store
schema
Collects query texts (plus all
relevant properties)
Stores all plan choices and
performance metrics
Works across restarts /
upgrades / recompiles
Dramatically lowers the bar for
performance troubleshooting
New Views
Intuitive and easy plan forcing
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Query Store schema explained
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Query Store Dashboard
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
@ITCAMPRO #ITCAMP16Community Conference for IT Professionals
Q & A

Contenu connexe

Tendances

Tendances (20)

Testing your PowerShell code with Pester - Florin Loghiade
Testing your PowerShell code with Pester - Florin LoghiadeTesting your PowerShell code with Pester - Florin Loghiade
Testing your PowerShell code with Pester - Florin Loghiade
 
Suddenly Reality - Peter Leeson
Suddenly Reality - Peter LeesonSuddenly Reality - Peter Leeson
Suddenly Reality - Peter Leeson
 
ITCamp 2017 - Raffaele Rialdi - A Deep Dive Into Bridging Node-js with .NET Core
ITCamp 2017 - Raffaele Rialdi - A Deep Dive Into Bridging Node-js with .NET CoreITCamp 2017 - Raffaele Rialdi - A Deep Dive Into Bridging Node-js with .NET Core
ITCamp 2017 - Raffaele Rialdi - A Deep Dive Into Bridging Node-js with .NET Core
 
Serverless Single Page Apps with React and Redux at ItCamp 2017
Serverless Single Page Apps with React and Redux at ItCamp 2017Serverless Single Page Apps with React and Redux at ItCamp 2017
Serverless Single Page Apps with React and Redux at ItCamp 2017
 
Creating Web and Mobile Apps with Angular 2 - George Saadeh
Creating Web and Mobile Apps with Angular 2 - George SaadehCreating Web and Mobile Apps with Angular 2 - George Saadeh
Creating Web and Mobile Apps with Angular 2 - George Saadeh
 
2016, A New Era of OS and Cloud Security - Tudor Damian
2016, A New Era of OS and Cloud Security - Tudor Damian2016, A New Era of OS and Cloud Security - Tudor Damian
2016, A New Era of OS and Cloud Security - Tudor Damian
 
The best of Windows Server 2016 - Thomas Maurer
 The best of Windows Server 2016 - Thomas Maurer The best of Windows Server 2016 - Thomas Maurer
The best of Windows Server 2016 - Thomas Maurer
 
What's New in Hyper-V 2016 - Thomas Maurer
What's New in Hyper-V 2016 - Thomas MaurerWhat's New in Hyper-V 2016 - Thomas Maurer
What's New in Hyper-V 2016 - Thomas Maurer
 
Modern cybersecurity threats, and shiny new tools to help deal with them - T...
 Modern cybersecurity threats, and shiny new tools to help deal with them - T... Modern cybersecurity threats, and shiny new tools to help deal with them - T...
Modern cybersecurity threats, and shiny new tools to help deal with them - T...
 
Azure Microservices in Practice - Radu Vunvulea
Azure Microservices in Practice - Radu VunvuleaAzure Microservices in Practice - Radu Vunvulea
Azure Microservices in Practice - Radu Vunvulea
 
Windows 10 Creators Update: what’s on tap for business users - Ionut Balan
Windows 10 Creators Update: what’s on tap for business users - Ionut BalanWindows 10 Creators Update: what’s on tap for business users - Ionut Balan
Windows 10 Creators Update: what’s on tap for business users - Ionut Balan
 
#NoAgile - Dan Suciu
 #NoAgile - Dan Suciu #NoAgile - Dan Suciu
#NoAgile - Dan Suciu
 
Migrating to Continuous Delivery with TFS 2017 - Liviu Mandras-Iura
 Migrating to Continuous Delivery with TFS 2017 - Liviu Mandras-Iura Migrating to Continuous Delivery with TFS 2017 - Liviu Mandras-Iura
Migrating to Continuous Delivery with TFS 2017 - Liviu Mandras-Iura
 
The Vision of Computer Vision: The bold promise of teaching computers to unde...
The Vision of Computer Vision: The bold promise of teaching computers to unde...The Vision of Computer Vision: The bold promise of teaching computers to unde...
The Vision of Computer Vision: The bold promise of teaching computers to unde...
 
Azure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
Azure tales: a real world CQRS and ES Deep Dive - Andrea SaltarelloAzure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
Azure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
 
BUILD with Microsoft - Radu Stefan
 BUILD with Microsoft - Radu Stefan BUILD with Microsoft - Radu Stefan
BUILD with Microsoft - Radu Stefan
 
From Developer to Data Scientist - Gaines Kergosien
From Developer to Data Scientist - Gaines KergosienFrom Developer to Data Scientist - Gaines Kergosien
From Developer to Data Scientist - Gaines Kergosien
 
Blockchain for mere mortals - understand the fundamentals and start building ...
Blockchain for mere mortals - understand the fundamentals and start building ...Blockchain for mere mortals - understand the fundamentals and start building ...
Blockchain for mere mortals - understand the fundamentals and start building ...
 
How to secure and manage modern IT - Ondrej Vysek
 How to secure and manage modern IT - Ondrej Vysek How to secure and manage modern IT - Ondrej Vysek
How to secure and manage modern IT - Ondrej Vysek
 
Docker adventures in Continuous Delivery - Alex Vranceanu
Docker adventures in Continuous Delivery - Alex VranceanuDocker adventures in Continuous Delivery - Alex Vranceanu
Docker adventures in Continuous Delivery - Alex Vranceanu
 

En vedette

En vedette (14)

ITCamp 2016 Keynote
ITCamp 2016 KeynoteITCamp 2016 Keynote
ITCamp 2016 Keynote
 
Enacting Scrum - What it takes to maximize the chances for a successful adopt...
Enacting Scrum - What it takes to maximize the chances for a successful adopt...Enacting Scrum - What it takes to maximize the chances for a successful adopt...
Enacting Scrum - What it takes to maximize the chances for a successful adopt...
 
Investing in Presales - George Bara
Investing in Presales - George BaraInvesting in Presales - George Bara
Investing in Presales - George Bara
 
Business Processes in Microsoft Dynamics CRM - Nicu Aleman
Business Processes in Microsoft Dynamics CRM - Nicu AlemanBusiness Processes in Microsoft Dynamics CRM - Nicu Aleman
Business Processes in Microsoft Dynamics CRM - Nicu Aleman
 
Create The Internet of Your Things example of a real system - Laurent Ellerbach
Create The Internet of Your Things example of a real system - Laurent EllerbachCreate The Internet of Your Things example of a real system - Laurent Ellerbach
Create The Internet of Your Things example of a real system - Laurent Ellerbach
 
Frustration Management - Dan Danciu
Frustration Management - Dan DanciuFrustration Management - Dan Danciu
Frustration Management - Dan Danciu
 
Azure SQL Database From A Developer's Perspective - Alex Mang
Azure SQL Database From A Developer's Perspective - Alex MangAzure SQL Database From A Developer's Perspective - Alex Mang
Azure SQL Database From A Developer's Perspective - Alex Mang
 
Cluj 2030 a vision on IT - will it thrive or will it flop - Mihai Nadas
Cluj 2030 a vision on IT - will it thrive or will it flop - Mihai NadasCluj 2030 a vision on IT - will it thrive or will it flop - Mihai Nadas
Cluj 2030 a vision on IT - will it thrive or will it flop - Mihai Nadas
 
The rise of privacy & personal data in the IT business - Claudia Jelea
The rise of privacy & personal data in the IT business - Claudia JeleaThe rise of privacy & personal data in the IT business - Claudia Jelea
The rise of privacy & personal data in the IT business - Claudia Jelea
 
Emerging Experiences - More Personal Computing (MPC) - Tim Huckaby
Emerging Experiences - More Personal Computing (MPC) - Tim HuckabyEmerging Experiences - More Personal Computing (MPC) - Tim Huckaby
Emerging Experiences - More Personal Computing (MPC) - Tim Huckaby
 
Building Your First SPA with Aurelia and MVC 6 - Mihai Coros
Building Your First SPA with Aurelia and MVC 6 - Mihai CorosBuilding Your First SPA with Aurelia and MVC 6 - Mihai Coros
Building Your First SPA with Aurelia and MVC 6 - Mihai Coros
 
Live Presentation Transformation From Boring to Effective - Boris Hristov
Live Presentation Transformation From Boring to Effective - Boris HristovLive Presentation Transformation From Boring to Effective - Boris Hristov
Live Presentation Transformation From Boring to Effective - Boris Hristov
 
SQL Azure Data Warehouse - Silviu Niculita
SQL Azure Data Warehouse - Silviu NiculitaSQL Azure Data Warehouse - Silviu Niculita
SQL Azure Data Warehouse - Silviu Niculita
 
Component Based UI Architecture - Alex Moldovan
Component Based UI Architecture - Alex MoldovanComponent Based UI Architecture - Alex Moldovan
Component Based UI Architecture - Alex Moldovan
 

Similaire à Execution Plans in practice - how to make SQL Server queries faster - Damian Widera

Similaire à Execution Plans in practice - how to make SQL Server queries faster - Damian Widera (20)

ITCamp 2018 - Damian Widera U-SQL in great depth
ITCamp 2018 - Damian Widera U-SQL in great depthITCamp 2018 - Damian Widera U-SQL in great depth
ITCamp 2018 - Damian Widera U-SQL in great depth
 
ITCamp 2018 - Damian Widera - SQL Server 2016. Meet the Row Level Security. P...
ITCamp 2018 - Damian Widera - SQL Server 2016. Meet the Row Level Security. P...ITCamp 2018 - Damian Widera - SQL Server 2016. Meet the Row Level Security. P...
ITCamp 2018 - Damian Widera - SQL Server 2016. Meet the Row Level Security. P...
 
Scaling face recognition with big data - Bogdan Bocse
 Scaling face recognition with big data - Bogdan Bocse Scaling face recognition with big data - Bogdan Bocse
Scaling face recognition with big data - Bogdan Bocse
 
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data LakeITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
 
Scaling Face Recognition with Big Data
Scaling Face Recognition with Big DataScaling Face Recognition with Big Data
Scaling Face Recognition with Big Data
 
Azure Microservices in Practice, Radu Vunvulea, ITCamp 2016
Azure Microservices in Practice, Radu Vunvulea, ITCamp 2016Azure Microservices in Practice, Radu Vunvulea, ITCamp 2016
Azure Microservices in Practice, Radu Vunvulea, ITCamp 2016
 
It camp 2015 how to scale above clouds limits, radu vunvulea
It camp 2015   how to scale above clouds limits, radu vunvuleaIt camp 2015   how to scale above clouds limits, radu vunvulea
It camp 2015 how to scale above clouds limits, radu vunvulea
 
ITCamp 2019 - Mihai Tataran - Governing your Cloud Resources
ITCamp 2019 - Mihai Tataran - Governing your Cloud ResourcesITCamp 2019 - Mihai Tataran - Governing your Cloud Resources
ITCamp 2019 - Mihai Tataran - Governing your Cloud Resources
 
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
 
ITCamp 2018 - Ciprian Sorlea - Enterprise Architectures with TypeScript And F...
ITCamp 2018 - Ciprian Sorlea - Enterprise Architectures with TypeScript And F...ITCamp 2018 - Ciprian Sorlea - Enterprise Architectures with TypeScript And F...
ITCamp 2018 - Ciprian Sorlea - Enterprise Architectures with TypeScript And F...
 
ITCamp 2019 - Florin Loghiade - Azure Kubernetes in Production - Field notes...
ITCamp 2019 - Florin Loghiade -  Azure Kubernetes in Production - Field notes...ITCamp 2019 - Florin Loghiade -  Azure Kubernetes in Production - Field notes...
ITCamp 2019 - Florin Loghiade - Azure Kubernetes in Production - Field notes...
 
The fight for surviving in the IoT world
The fight for surviving in the IoT worldThe fight for surviving in the IoT world
The fight for surviving in the IoT world
 
The fight for surviving in the IoT world - Radu Vunvulea
The fight for surviving in the IoT world - Radu VunvuleaThe fight for surviving in the IoT world - Radu Vunvulea
The fight for surviving in the IoT world - Radu Vunvulea
 
A new world of possibilities for contextual awareness with beacons
A new world of possibilities for contextual awareness with beaconsA new world of possibilities for contextual awareness with beacons
A new world of possibilities for contextual awareness with beacons
 
Old code doesn't stink - Detroit
Old code doesn't stink - DetroitOld code doesn't stink - Detroit
Old code doesn't stink - Detroit
 
Azure Stream Analytics
Azure Stream AnalyticsAzure Stream Analytics
Azure Stream Analytics
 
Single Source of Truth for Network Automation
Single Source of Truth for Network AutomationSingle Source of Truth for Network Automation
Single Source of Truth for Network Automation
 
ITCamp 2018 - Andrea Martorana Tusa - Writing queries in SQL Server 2016-2017
ITCamp 2018 - Andrea Martorana Tusa - Writing queries in SQL Server 2016-2017ITCamp 2018 - Andrea Martorana Tusa - Writing queries in SQL Server 2016-2017
ITCamp 2018 - Andrea Martorana Tusa - Writing queries in SQL Server 2016-2017
 
Hybrid Transactional/Analytics Processing with Spark and IMDGs
Hybrid Transactional/Analytics Processing with Spark and IMDGsHybrid Transactional/Analytics Processing with Spark and IMDGs
Hybrid Transactional/Analytics Processing with Spark and IMDGs
 
ITCamp 2019 - Andrea Saltarello - Implementing bots and Alexa skills using Az...
ITCamp 2019 - Andrea Saltarello - Implementing bots and Alexa skills using Az...ITCamp 2019 - Andrea Saltarello - Implementing bots and Alexa skills using Az...
ITCamp 2019 - Andrea Saltarello - Implementing bots and Alexa skills using Az...
 

Plus de ITCamp

ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UXITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
ITCamp
 

Plus de ITCamp (20)

ITCamp 2019 - Stacey M. Jenkins - Protecting your company's data - By psychol...
ITCamp 2019 - Stacey M. Jenkins - Protecting your company's data - By psychol...ITCamp 2019 - Stacey M. Jenkins - Protecting your company's data - By psychol...
ITCamp 2019 - Stacey M. Jenkins - Protecting your company's data - By psychol...
 
ITCamp 2019 - Silviu Niculita - Supercharge your AI efforts with the use of A...
ITCamp 2019 - Silviu Niculita - Supercharge your AI efforts with the use of A...ITCamp 2019 - Silviu Niculita - Supercharge your AI efforts with the use of A...
ITCamp 2019 - Silviu Niculita - Supercharge your AI efforts with the use of A...
 
ITCamp 2019 - Peter Leeson - Managing Skills
ITCamp 2019 - Peter Leeson - Managing SkillsITCamp 2019 - Peter Leeson - Managing Skills
ITCamp 2019 - Peter Leeson - Managing Skills
 
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UXITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
 
ITCamp 2019 - Florin Coros - Implementing Clean Architecture
ITCamp 2019 - Florin Coros - Implementing Clean ArchitectureITCamp 2019 - Florin Coros - Implementing Clean Architecture
ITCamp 2019 - Florin Coros - Implementing Clean Architecture
 
ITCamp 2019 - Florin Flestea - How 3rd Level support experience influenced m...
ITCamp 2019 - Florin Flestea -  How 3rd Level support experience influenced m...ITCamp 2019 - Florin Flestea -  How 3rd Level support experience influenced m...
ITCamp 2019 - Florin Flestea - How 3rd Level support experience influenced m...
 
ITCamp 2019 - Eldert Grootenboer - Cloud Architecture Recipes for The Enterprise
ITCamp 2019 - Eldert Grootenboer - Cloud Architecture Recipes for The EnterpriseITCamp 2019 - Eldert Grootenboer - Cloud Architecture Recipes for The Enterprise
ITCamp 2019 - Eldert Grootenboer - Cloud Architecture Recipes for The Enterprise
 
ITCamp 2019 - Cristiana Fernbach - Blockchain Legal Trends
ITCamp 2019 - Cristiana Fernbach - Blockchain Legal TrendsITCamp 2019 - Cristiana Fernbach - Blockchain Legal Trends
ITCamp 2019 - Cristiana Fernbach - Blockchain Legal Trends
 
ITCamp 2019 - Andy Cross - Business Outcomes from AI
ITCamp 2019 - Andy Cross - Business Outcomes from AIITCamp 2019 - Andy Cross - Business Outcomes from AI
ITCamp 2019 - Andy Cross - Business Outcomes from AI
 
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud StoryITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
 
ITCamp 2019 - Alex Mang - I'm Confused Should I Orchestrate my Containers on ...
ITCamp 2019 - Alex Mang - I'm Confused Should I Orchestrate my Containers on ...ITCamp 2019 - Alex Mang - I'm Confused Should I Orchestrate my Containers on ...
ITCamp 2019 - Alex Mang - I'm Confused Should I Orchestrate my Containers on ...
 
ITCamp 2019 - Alex Mang - How Far Can Serverless Actually Go Now
ITCamp 2019 - Alex Mang - How Far Can Serverless Actually Go NowITCamp 2019 - Alex Mang - How Far Can Serverless Actually Go Now
ITCamp 2019 - Alex Mang - How Far Can Serverless Actually Go Now
 
ITCamp 2019 - Peter Leeson - Vitruvian Quality
ITCamp 2019 - Peter Leeson - Vitruvian QualityITCamp 2019 - Peter Leeson - Vitruvian Quality
ITCamp 2019 - Peter Leeson - Vitruvian Quality
 
ITCamp 2018 - Ciprian Sorlea - Million Dollars Hello World Application
ITCamp 2018 - Ciprian Sorlea - Million Dollars Hello World ApplicationITCamp 2018 - Ciprian Sorlea - Million Dollars Hello World Application
ITCamp 2018 - Ciprian Sorlea - Million Dollars Hello World Application
 
ITCamp 2018 - Mete Atamel Ian Talarico - Google Home meets .NET containers on...
ITCamp 2018 - Mete Atamel Ian Talarico - Google Home meets .NET containers on...ITCamp 2018 - Mete Atamel Ian Talarico - Google Home meets .NET containers on...
ITCamp 2018 - Mete Atamel Ian Talarico - Google Home meets .NET containers on...
 
ITCamp 2018 - Magnus Mårtensson - Azure Global Application Perspectives
ITCamp 2018 - Magnus Mårtensson - Azure Global Application PerspectivesITCamp 2018 - Magnus Mårtensson - Azure Global Application Perspectives
ITCamp 2018 - Magnus Mårtensson - Azure Global Application Perspectives
 
ITCamp 2018 - Magnus Mårtensson - Azure Resource Manager For The Win
ITCamp 2018 - Magnus Mårtensson - Azure Resource Manager For The WinITCamp 2018 - Magnus Mårtensson - Azure Resource Manager For The Win
ITCamp 2018 - Magnus Mårtensson - Azure Resource Manager For The Win
 
ITCamp 2018 - Ionut Balan - A beginner’s guide to Windows Mixed Reality
ITCamp 2018 - Ionut Balan - A beginner’s guide to Windows Mixed RealityITCamp 2018 - Ionut Balan - A beginner’s guide to Windows Mixed Reality
ITCamp 2018 - Ionut Balan - A beginner’s guide to Windows Mixed Reality
 
ITCamp 2018 - Florin Coros - ‘Cloud Ready’ Design through Application Softwar...
ITCamp 2018 - Florin Coros - ‘Cloud Ready’ Design through Application Softwar...ITCamp 2018 - Florin Coros - ‘Cloud Ready’ Design through Application Softwar...
ITCamp 2018 - Florin Coros - ‘Cloud Ready’ Design through Application Softwar...
 
ITCamp 2018 - Cristiana Fernbach - GDPR compliance in the industry 4.0
ITCamp 2018 - Cristiana Fernbach - GDPR compliance in the industry 4.0ITCamp 2018 - Cristiana Fernbach - GDPR compliance in the industry 4.0
ITCamp 2018 - Cristiana Fernbach - GDPR compliance in the industry 4.0
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+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@
 

Dernier (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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 ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
+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...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 

Execution Plans in practice - how to make SQL Server queries faster - Damian Widera

  • 1. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Execution plans in practice – how to make SQL Server queries faster Damian Widera Microsoft Data Platform MVP EUVIC @damianwidera http://sqlblog.com/blogs/damian_widera/default.aspx
  • 2. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Many thanks to our sponsors & partners! GOLD SILVER PARTNERS PLATINUM POWERED BY
  • 3. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Come to Poland on October 1st!
  • 4. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Damian Widera
  • 5. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals EUVIC PALO ALTO NOWY JORK WARSZAWA KATOWICE GLIWICE BIELSKO BIAŁA WROCŁAW CZĘSTOCHOWA GDYNIA KRAKÓW BYDGOSZCZ WIEDEŃ BIAŁYSTOK
  • 6. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Customers…
  • 7. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals • What is bad in terms of query execution • What was bad in previous examples is not always bad… • SQL Server 2016 – how could it help? Today I am going to tell about….
  • 8. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals SQL Server School of Art
  • 9. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals • A query takes long time to execute • A query consumes too much resources • Then we have: –Reduced concurency –More locks that should be • Locks contentions, waits, etc… What is bad in terms of query execution
  • 10. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals • A query (logical) is parsed and optimized based on all available information (cost optimization) • Estimation != Guestimation • Plan(s) is (are) produced How it works
  • 11. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Bad row estimates can impact a variety of decisions including: • index selection seek vs. scan operations, • parallel versus serial execution, • join algorithm selection, • inner vs. outer physical join selection (e.g. build vs. probe), • spool generation, • bookmark lookups vs. full clustered or heap table access, • stream or hash aggregate selection Why it is so important?
  • 12. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals • Index or table scans (*): May indicate a need for better or additional indexes (*) – THIS IS NOT ALWAYS WRONG!!!! • Bookmark Lookups: Consider changing the current clustered index, consider using a covering index, limit the number of columns in the SELECT statement. • Filter: Remove any functions in the WHERE clause, don’t include views in your Transact-SQL code, may need additional indexes. What to look for…
  • 13. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals • Sort: Does the data really need to be sorted? Can an index be used to avoid sorting? Can sorting be done at the client more efficiently? „Hidden” sort. Nonlinear operation • Spool. Used as a cache in the QP. Reason – lack of indexes or uniqueness. Implemented as a hidden tables in tempdb • Hash. Used for joins and aggregations. Builds a hashtable in memory (or in tempdb). Means there is no good index. What to look for…
  • 15. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals • When index scan is the best option –Two examples • High density -> Seek • Low density -> Scan • When cursor can be the best option (especially for SQL Server 2008 R2 and older) –Running total What was bad in previous example is not always bad…
  • 17. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals New functionality that makes DBAs’ happy - Query Store will be available in all editions SQL Server 2016 – how could it help?
  • 18. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Query data store Durability latency controlled by DB option DATA_FLUSH_INTERNAL_SECONDS Compile Execute Plan store Runtime stats Query Store schema Collects query texts (plus all relevant properties) Stores all plan choices and performance metrics Works across restarts / upgrades / recompiles Dramatically lowers the bar for performance troubleshooting New Views Intuitive and easy plan forcing
  • 19. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Query Store schema explained
  • 20. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Query Store Dashboard
  • 22. @ITCAMPRO #ITCAMP16Community Conference for IT Professionals Q & A