Beskrivning
Prerequisites
Ability to use tools for running queries against a Microsoft SQL database, either on-premises on cloud-based
Ability to write code in the SQL language, particularly the Microsoft T-SQL dialect, at a basic level.
Basic understanding of structure and usage of SQL Server indexes
Basic understanding of relational database concepts
Learning objectives:
Compare the different types of execution plans
Understand the purpose and benefits of the Query Store
Investigate the available reports and data in the Query Store
Understand how blocking and locking work in the SQL Server database engine
1. Introduction
The most important skill you should acquire in database performance tuning is being able to read and understand query execution plans. The plans explain the behavior of the database engine as it executes queries and retrieves the results.
2. Understand query plans
This plan viewing option combines the estimated and actual plans into an animated plan that displays execution progress through the operators in the plan. It refreshes every second and shows the actual number of rows flowing through the operators. The other benefit to Live Query Statistics is that it shows the handoff from operator to operator, which may be helpful in troubleshooting some performance issues. Because the type of plan is animated, it’s only available as a graphical plan.
3. Explain estimated and actual query plans
The topic of actual versus estimated execution plans can be confusing. The difference is that the actual plan includes runtime statistics that aren’t captured in the estimated plan. The operators used, and order of execution will be the same as the estimated plan in nearly all cases. The other consideration is that in order to capture an actual execution plan the query has to be executed, which can be time consuming, or not possible. For example, the query may be an UPDATE statement that can only be run once. However, if you need to see query results and the plan, you’ll need to use one of the actual plan options.
4. Describe dynamic management views and functions
SQL Server provides several hundred dynamic management objects. These objects contain system information that can be used to monitor the health of a server instance, diagnose problems, and tune performance. Dynamic management views and functions return internal data about the state of the database or the instance. Dynamic Management Objects can be either views (DMVs) or functions (DMFs), but most people use the acronym DMV to refer to both types of object.
5. Explore Query Store
The SQL Server Query Store is a per-database feature that automatically captures a history of queries, plans, and runtime statistics to simplify performance troubleshooting and query tuning. It also provides insight into database usage patterns and resource consumption.
6. Identify problematic query plans
The path most DBAs take to troubleshoot query performance is to first identify the problematic query (typically the query consuming the highest amount of system resources), and then retrieve that query’s execution plan. There are two scenarios.
7. Describe blocking and locking
One feature of relational databases is locking, which is essential to maintain the atomicity, consistency, and isolation properties of the ACID model. All RDBMSs will block actions that would violate the consistency and isolation of writes to a database. SQL programmers are responsible for starting and ending transactions at the right point, in order to ensure the logical consistency of their data.
8. Summary/Knowledge check
Recensioner
Det finns inga recensioner än.