Basic Execution Plans Eugene Meidinger emeidinger@all-lines-tech.com @sqlgene www.sqlgene.com Thank you to our Sponsors!!! Who is All Lines Technology? • All Lines Technology is a local woman owned solutions provider with corporate headquarters in Warrendale, PA, with offices in Cleveland, Columbus and Morgantown. • Our parent company, Fire Fighter Sales & Service Co. has been in business since 1946, supplying fire suppression and life safety products and services to over 15,000 customers in the tri-state area. • Customer service has been the cornerstone of our business for over 60 years. • Strong company foundation and financial stability achieving year of year profitable revenue growth. Who is LANtek? • • • • • • • • • • Staffing – Named largest, local Staffing Firm in Western PA since 2011 Hardware Break / Fix Application Development SharePoint Services NOC / Help Desk Services Network/LAN/WAN Design &Delivery Datacenter Design &Architecture PC Deployment VDI and BYOD Solutions Cloud Services, including LANtek hosted &MS Office 365 & Azure Who am I? • • • • • • Accidental DBA Graduated Penn State 2010 for IST First Job was in BI department at Bayer Head of small BI department at FF/ALT/Lantek Certified in Querying SQL Server 2012 Started speaking a year ago – • Don’t go to the SQL Saturday after event! You’ll get drafted Not an expert, just know enough to speak What are we going to talk about? • • • • • • • What is an execution Plan How to view an execution plan What does a plan look like How to read one Demo Resources Q/A What is an execution plan? • Instructions for how to process a query – • • • Can think of it as a recipe Created by query optimizer at run time Execution plans are cached after the first run Many different ways to process the same query – – – For trivial queries, a simple plan is used Can be forced with hints Don’t try to outsmart the database engine How to view the execution plan? • Go to Query – • • Click Include Actual Execution Plan Or, Press Ctrl + M Or click the Execution Plan Icon on the tool bar What does a plan look like? How to read an execution plan • • Read from right to left and top to bottom Icons represent operators – • Arrows represent data flow – • Operators have cost below them in % Bigger arrows represent more data Hover over icons and arrows for more detail Demo Resources Adventure Works Database Execution Plan Basics by Grant Fritchey SQL Server Execution Plans, Second Edition by Grant Fritchey Watch Brent Ozar Tune Queries by Brent Ozar Questions? Thank you!