Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Create Missing Index

(0) ShareShare
ReportReport
Posted on by 1,257

Hi,

How do i create missing index based on the query below. The query is for Dynamics CRM 365 on premise.

select      o.name as Table_Name

            , REPLACE(d.equality_columns,', ','¦') as Equality_Columns

            , REPLACE(d.inequality_columns,', ','¦') as Inequality_Columns

            , REPLACE(d.included_columns,', ','¦') as Included_Columns

            , d.statement

            , s.avg_total_user_cost

            , s.avg_user_impact

            , s.user_seeks

from        sys.dm_db_missing_index_group_stats s

            ,sys.dm_db_missing_index_groups g

            ,sys.dm_db_missing_index_details d

            ,sys.objects o

where       s.group_handle = g.index_group_handle

            and d.index_handle = g.index_handle

            and o.object_id = d.object_id

            and database_id = db_id()

            and avg_user_impact > 80

order by s.user_seeks desc

go

  • Suggested answer
    saurabhtiwarii Profile Picture
    on at
    RE: Create Missing Index

    Hi Mike,

    I prefer analyzing slow-running queries, examining the query execution plan helps to determine what is causing the problem. Seeks, scans, and lookups are some of the ways indexes get utilized through select statements. Selectivity of key columns is crucial to determe how effective an index can be. For more information about how SQL Server creates and uses execution plans, see SQL Statement Processing and Execution Plan Caching and Reuse

    I also sometimes prefer to submit tune requests to the Database Tuning advisor as a workload for slow/time consuming SQL statements to see if there are any tuning recommendations ::

    Create Transact-SQL script workloads

    https://docs.microsoft.com/en-us/sql/relational-databases/performance/start-and-use-the-database-engine-tuning-advisor?view=sql-server-ver15#SSMS

    Tune a database using a workload file or table as input ::

    https://docs.microsoft.com/en-us/sql/relational-databases/performance/start-and-use-the-database-engine-tuning-advisor?view=sql-server-ver15#to-tune-a-database-using-a-workload-file-or-table-as-input

    I would also recommed using Query Store feature which automatically captures a history of queries, plans, and runtime statistics, and retains these for your review.

    https://docs.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store?view=sql-server-ver15

    Please mark my comments as answered if it helps 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans