MSSQL execution plan optimization recommendations

 

Plan of Implementation: Submit sql statement, the database query optimizer, after analysis to generate, develop multiple ways to search, choose to use the least resources

Database implementation plan is developed in accordance with minimum use of resources, rather than shortest time

 

 

Corresponding meaning:

1, affected the number of rows

2, the number of bytes affected

3, the data size of the impact

 

 

Implementation plan:

  1, Table Scan full table scan performance the worst

  2, Cluster Index Scan worst performance, although there is a clustered index above, it is actually a full table scan

  3, Index Seek (NonClustered) a very high performance

  4, Index Scan first index, and then scan

  5, Cluster Index Seek maximum performance

 

  Generally out of the question, look at the implementation plan, identify scan, index change, to see results, try

  profiler good tool

 

Regular SQL optimization tips:

  1, calculation of the column to avoid any form should be avoided

  2, in the query or query, the index will fail, it may be split

  3、in 换exists

    Do not in use, do not take the index

  4, is null and is not null not take the index

  5, <> not take the index

    It can be split into> and <

  6, join, the less the higher performance links

    Left links to the left, whichever results

    Turn right link,

    Connection with indexed field requirements

 

Guess you like

Origin www.cnblogs.com/Iven-zhang/p/12185448.html