Question

Duplicata possible:
Insert d'index non cluster

J'essaie de déterminer le coût d'avoir un index non cluster sur un tableau particulier, mais je ne vois aucun coût de maintenance dans le plan d'exécution pour un insert.

La table ressemble à ceci:

    CREATE TABLE [dbo].[ASPStateTempSessions](
    [SessionId] [nvarchar](88) NOT NULL,
    [Created] [datetime] NOT NULL,
    [Expires] [datetime] NOT NULL,
    [LockDate] [datetime] NOT NULL,
    [LockDateLocal] [datetime] NOT NULL,
    [LockCookie] [int] NOT NULL,
    [Timeout] [int] NOT NULL,
    [Locked] [bit] NOT NULL,
    [SessionItemShort] [varbinary](7000) NULL,
    [SessionItemLong] [image] NULL,
    [Flags] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
    [SessionId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[ASPStateTempSessions] ADD  DEFAULT (getutcdate()) FOR [Created]
GO

ALTER TABLE [dbo].[ASPStateTempSessions] ADD  DEFAULT ((0)) FOR [Flags]
GO

En plus d'un index cluster sur [SessionID], il a l'index non cluster suivant

/****** Object:  Index [Index_Expires]    Script Date: 12/14/2012 10:13:58 ******/
CREATE NONCLUSTERED INDEX [Index_Expires] ON [dbo].[ASPStateTempSessions] 
(
    [Expires] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

Mais lorsque j'exécute un plan d'exécution pour les éléments suivants, qui met à jour la colonne sur laquelle il existe un index non groupé:

UPDATE [ASPState].dbo.ASPStateTempSessions
            SET Expires = DATEADD(n, Timeout, GETUTCDATE())
            WHERE SessionId = '32gghltsuoesnvlzbehchp2m2014c0f1'
            RETURN 0 

Je ne vois aucune mention du coût dans le plan d'exécution:

enter image description here

Est-il habituel de ne pas le voir? Comment puis-je calculer le coût de cet indice dans les opérations d'écriture?

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à dba.stackexchange
scroll top