web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Suggested answer
    saurabhtiwarii Profile Picture
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans