Index analysis

1. Index Methodology

The indexing methodology consists of 3 steps: monitoring analysis and implementation. These three steps are run in a loop, first monitoring, then analyzing, and finally implementing, and then monitoring and analyzing, until there are no obvious and potential indexing problems.

2. Monitoring

There are three common monitoring tools:

1. Performance Monitor

2. Dynamically manage objects

3.SQL Trace

IF DB_ID(N'IndexDemo') IS NOT NULL
    DROP DATABASE IndexDemo
CREATE DATABASE IndexDemo
go
--Create a table to store the value of the corresponding counter:
USE IndexDemo
GO
IF OBJECT_ID(N'IndexingCounters', 'U') IS NOT NULL
    DROP TABLE IndexingCounters
CREATE TABLE IndexingCounters
    (
      counter_id INT IDENTITY(1, 1) ,
      create_date DATETIME ,
      server_name VARCHAR(128) NOT NULL ,
      object_name VARCHAR(128) NOT NULL ,
      counter_name VARCHAR(128) NOT NULL ,
      instance_name VARCHAR(128) NULL ,
      Calculated_Counter_value FLOAT NULL ,
      CONSTRAINT PK_IndexingCounters PRIMARY KEY CLUSTERED ( counter_id )
    )
GO
CREATE NONCLUSTERED INDEX IX_IndexingCounters_CounterName
ON dbo.IndexingCounters (counter_name)
INCLUDE (create_date,server_name,object_name,Calculated_Counter_value)

 For performance counters, it can be queried very frequently, but if it is monitoring index-related situations, it is not necessary to be too intensive, and it can be executed every 5 minutes

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324724708&siteId=291194637