Stop Doing That! Common T-SQL Anti-Patterns

Slides:



Advertisements
Similar presentations
Stop Doing That! Common T-SQL Anti-Patterns
Advertisements

Mean Value and Rolle’s Theorem
Review- 6 Differentiation Rules
Blue Collar SQL Tricks - Make Standard Edition Work for you.
Area between Polar Curves
Small Business Administration Entrepreneurship Track
Review- 7 Implicit Differentiation
Family Philanthropy and United Way
Intergration and U-Substitution
Lainie Chang Grand Canyon University January 20, 2010 TEC 542
Integration Techniques
– ELA/Reading Units 3rd grade
introduction to the Hospitality and Catering Industry
Converting a Definite Integral to a limit of a Riemann Sum and converting a limit of a Riemann Sum to a Definite Integral This template can be used as.
Stop Doing That! Common T-SQL Anti-Patterns
Training New Employees
Optimization and Parallelization of CBD models
David Taylor and Rhonda King Region 18 Education Service Center
Sect. 9-5 continued Absolute convergence and conditional convergence
COPS Digital Expansion Project
The muscular System This template can be used as a starter file for presenting training materials in a group setting. Sections Sections can help to organize.
Training New Employees
Training New Employees
Introduction to Gateway to Data (G2D)
Jackie Carpenter 3rd September 2016
AVCP Tribal Justice Healing Circle Training
Classified Evaluation System
Stop Doing That! Common T-SQL Anti-Patterns
Dr. Hatem Elaydi Fall 2014 Lead Compensator
How to Access the Jason Foundation App
Stop Doing That! Common T-SQL Anti-Patterns
Jane Ashdown, Adelphi University 2/14/2013 & 2/26/2013
Virtual Desktop Infrastructure Data Center
صندوق ضمانت سرمایه گذاری صنایع کوچک
Financial Update Period 6
AVCP Tribal Justice Healing Circle Training
Transit Center Location Analysis
Financial Update Period 7
Financial Update Period 4
Place Your Presentation Name Here
Is Baptism Necessary for Salvation?
Financial Update Period 5
Residency director & Faculty Training
Place Your Presentation Name Here
Place Your Presentation Name Here
فناوری نانو در صنعت خودرو
مدل سازی ترافیک شبکه استاد راهنما: دکتر کیارش میزانیان
Bell Ringer 10/8/12 Which of the following expressions will not equal 2 when x= 1? a) 1/2 (8x - 4) b) -4x + 1 c) 4x - 2 d) -4x + 6 e.) x.
Place Your Presentation Name Here
Introduction To Computers & Computing [EED 301]
Financial Update Period 4
Financial Update Period 9
STUDY in CALIFORNIA Community Colleges
The Role of Brain Processes in Partisan Politics
Classified Evaluation System
Kapitel 4-Stufe 2 Lieblings-
Powering Africa This template can be used as a starter file to give updates for project milestones. Sections Sections can help to organize your slides.
Chapter 11 Review (Civil War)
Making graphs from data
Telling Time in Spanish
WORKFORCE DEANS’ ACADEMY
Chapter 11 Review (Civil War)
Training New Employees
Blue Collar SQL Tricks - Make Standard Edition Work for you.
THESIS OFFICE ACCOMPLISHMENTS
Sample PowerPoint presentation
Monitoring & Evaluation
HVAC 101 Brent Herstine May 2017
Presenter Name Presentation Date
BPKC NUMERICAL ANALYSIS ASSIGNMENT-3
Presentation transcript:

Stop Doing That! Common T-SQL Anti-Patterns ~ Wolf ~ This template can be used as a starter file for presenting training materials in a group setting. Sections Right-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors. Notes Use the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production) Coordinated colors Pay particular attention to the graphs, charts, and text boxes. Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale. Graphics, tables, and graphs Keep it simple: If possible, use consistent, non-distracting styles and colors. Label all graphs and tables.

Resources to use: #sqlsatNYC #sqlhelp #sqlserver Add slides to each topic section as necessary, including slides with tables, graphs, and images. See next section for sample table, graph, image, and video layouts. #sqlsatNYC #sqlhelp #sqlserver

About Wolf DBA for 16 years, SQL Server/Oracle combination At RDX for 6 years. “Manager – SQL Server Performance Tuning” Works with a variety of clients and challenges Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important. Introduce each of the major topics. To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.

There are 2 types of people in this world… http://newmediadl.cas.msu.edu/sites/default/files/uploads/users/1003/yankees-business-model1.jpg https://upload.wikimedia.org/wikipedia/en/thumb/a/aa/RedSoxSecondary_Circle.svg/1024px-RedSoxSecondary_Circle.svg.png

There are 2 types of people in this world… http://newmediadl.cas.msu.edu/sites/default/files/uploads/users/1003/yankees-business-model1.jpg https://upload.wikimedia.org/wikipedia/en/thumb/a/aa/RedSoxSecondary_Circle.svg/1024px-RedSoxSecondary_Circle.svg.png

Star Trek: Next Generation - http://i.stack.imgur.com/NTsOF.jpg

What we will focus on 1 2 3 Scalar-Value Function as part of Select State of the Union 2 Common Table Expressions 3 SARGability 4 This is another option for an Overview slide.

Scalar-Valued Function in the Select Use a section header for each of the topics, so there is a clear transition to the audience. Scalar-Valued Function in the Select

What is a Scalar-Valued Function? Scalar functions return a single data value of the type defined in the RETURNS clause. Supports nearly all data types with the exception of text, ntext, image, and timestamp Let’s see how they work Summarize presentation content by restating the important points from the lessons. What do you want the audience to remember when they leave your presentation? Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)

What did we see Scalar-Valued Function is great to reuse code When used as part of the select, the function will read, Row by Agonizing Row(RBAR) Summarize presentation content by restating the important points from the lessons. What do you want the audience to remember when they leave your presentation? Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)

Use a section header for each of the topics, so there is a clear transition to the audience. State of the Union

What is a Union? Union combines the results of two or more queries into a single result set that includes all the rows that belong to all queries in the union. Union is a great way to give a unique results set from different queries. A Union specifies that multiple result sets are to be combined and returned as a single result set. Let’s see how they work Summarize presentation content by restating the important points from the lessons. What do you want the audience to remember when they leave your presentation? Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)

What did we see? The union operator has its uses, but we can see that those uses come at a cost of reads and tempdb usage. At times, we may not have an alternative, but we need to be aware of the costs and use this functionality accordingly. Summarize presentation content by restating the important points from the lessons. What do you want the audience to remember when they leave your presentation? Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)

Common Table Expressions(CTE) Use a section header for each of the topics, so there is a clear transition to the audience. Common Table Expressions(CTE)

What are CTE? A common table expression (CTE) can be thought of as a defined derived table that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. Unlike a derived table, a CTE can be self- referencing and can be referenced multiple times in the same query. Add slides to each topic section as necessary, including slides with tables, graphs, and images. See next section for sample table, graph, image, and video layouts.

What did we see? CTE are a defined derived table With small recordsets and simple queries, they are acceptable They have no statistics or indexes available. They will not scale well Summarize presentation content by restating the important points from the lessons. What do you want the audience to remember when they leave your presentation? Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)

Use a section header for each of the topics, so there is a clear transition to the audience. SARGable

What is a SARGability? In relational databases, a condition (or predicate) in a query is said to be sargable if the DBMS engine can take advantage of an index to speed up the execution of the query. The term is derived from a contraction of Search ARGument ABLE. As DBAs, we do our best to write the queries to take advantage of the indexes as best we can. Searching! Seek and Destroy! Add slides to each topic section as necessary, including slides with tables, graphs, and images. See next section for sample table, graph, image, and video layouts.

What did we see? When we don’t take advantage of SARGability, we make the database work much harder than it needs to. Use “LIKE”, built-in functions and scalar- valued functions sparingly. Summarize presentation content by restating the important points from the lessons. What do you want the audience to remember when they leave your presentation? Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)

Forest Gump: http://funnyand

http://camurren.com/wp-content/uploads/2015/09/20150302162232-turtle-skateboard.jpeg

Metallica – Through The Never Movie https://youtu.be/kV-2Q8QtCY4

Microsoft Engineering Excellence Questions? Microsoft Confidential