Trong bài viết này

Applies to:

*
SQL vps (all supported versions)
*
Azure SQL Database
*
Azure SQL Managed Instance

To be able to execute queries, the SQL server Database Engine must analyze the statement khổng lồ determine the most efficient way to access the required data. This analysis is handled by a component called the Query Optimizer. The đầu vào to the Query Optimizer consists of the query, the database schema (table and index definitions), và the database statistics. The output of the Query Optimizer is a query execution plan, sometimes referred lớn as a query plan, or execution plan.

Bạn đang xem: Execution plan là gì

A query execution plan is a definition of the following:

The sequence in which the source tables are accessed.Typically, there are many sequences in which the database vps can access the base tables to lớn build the result set. For example, if a SELECT statement references three tables, the database vps could first access TableA, use the data from TableA to extract matching rows from TableB, và then use the data from TableB to lớn extract data from TableC. The other sequences in which the database hệ thống could access the tables are:TableC, TableB, TableA, orTableB, TableA, TableC, orTableB, TableC, TableA, orTableC, TableA, TableB

The methods used to lớn extract data from each table.Generally, there are different methods for accessing the data in each table. If only a few rows with specific key values are required, the database hệ thống can use an index. If all the rows in the table are required, the database hệ thống can ignore the indexes and perform a table scan. If all the rows in a table are required but there is an index whose key columns are in an ORDER BY, performing an index scan instead of a table scan may save a separate sort of the result set. If a table is very small, table scans may be the most efficient method for almost all access to lớn the table.

Xem thêm: Học Ngay 2 Cách Làm Sữa Ngô Bằng Máy Ép Chậm Cực Ngon Tại Nhà

The methods used lớn compute calculations, & how khổng lồ filter, aggregate, và sort data from each table.As data is accessed from tables, there are different methods khổng lồ perform calculations over data such as computing scalar values, and to aggregate & sort data as defined in the query text, for example when using a GROUP BY or ORDER BY clause, and how to lớn filter data, for example when using a WHERE or HAVING clause.


Tip

For more information on query processing và query execution plans, see the sections Optimizing SELECT statements và Execution Plan Caching and Reuse of the Query Processing Architecture Guide.


In This Section

Query Profiling InfrastructureDisplay and Save Execution PlansCompare and Analyze Execution PlansPlan Guides

See Also

Monitor & Tune for PerformancePerformance Monitoring & Tuning ToolsQuery Processing Architecture GuideLive Query StatisticsActivity MonitorMonitoring Performance by Using the Query Storesys.dm_exec_query_statistics_xmlsys.dm_exec_query_profilesTrace flagsShowplan Logical và Physical Operators Reference