How to create a new index: high-cost missing indexes

Source: Internet
Author: User
Tags table name

Indexes have a great impact on query performance, don't blindly create new indexes! Database high cost missing index, new required index based on statistics on dynamic performance view!

Select C.name as library name, C.equality_columns,

C.inequality_columns,c.included_columns,

C.statement as table name,

C.avg_total_user_cost as reduced average cost,

C.avg_user_impact as percent gain,

C.last_user_seek as use affects last result,

C.unique_compiles

From

(

Select a.name,b.* from

(

Select d.*

, S.avg_total_user_cost

, S.avg_user_impact

, S.last_user_seek

, S.unique_compiles

From Sys.dm_db_missing_index_group_stats s

, Sys.dm_db_missing_index_groups G

, Sys.dm_db_missing_index_details D

where S.group_handle = G.index_group_handle

and D.index_handle = G.index_handle

--order by s.avg_user_impact Desc

) B,

Sys.databases A

where a.database_id=b.database_id

) c

Order by percent revenue Desc,unique_compiles Desc

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/SQLServer/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.