Link artículo
SELECT t.name AS TablaNombre ,
t.type_desc
AS TablaTipo ,
i.name AS IndiceNombre ,
i.type_desc
AS IndiceTipo ,
CASE WHEN i.fill_factor = 0 THEN 100
ELSE
i.fill_factor
END AS IndiceFillFactor ,
(
SELECT
MAX(v)
FROM ( VALUES ( st.ServerStartTime), ( o.create_date),
(
o.modify_date) ) AS VALUE ( v )
) AS [EstadisticasDesde] ,
S.USER_SEEKS
,
S.USER_SCANS ,
S.USER_LOOKUPS
,
S.USER_UPDATES
FROM sys.tables t
INNER JOIN sys.indexes I ON I.OBJECT_ID = t.OBJECT_ID
LEFT OUTER JOIN SYS.DM_DB_INDEX_USAGE_STATS AS
S ON I.[OBJECT_ID]
= S.[OBJECT_ID]
AND I.INDEX_ID
= S.INDEX_ID
LEFT OUTER JOIN sys.objects o ON i.name = o.name
CROSS JOIN ( SELECT login_time AS ServerStartTime
FROM sys.sysprocesses
WHERE spid = 1
)
ST
WHERE
t.name IN ('table')
No hay comentarios:
Publicar un comentario