web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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

I have the same question (0)
  • Suggested answer
    saurabhtiwarii Profile Picture
    Microsoft Employee on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 101 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 72

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans