Search

'인덱스'에 해당되는 글 1건

  1. 2012.04.05 Check procedure

Check procedure

Database 2012. 4. 5. 16:34 Posted by Jay Choi


1. 사용중인 테이블 조회

WITH sp_list AS (
    SELECT o.name AS proc_name
           , oo.name AS table_name
           , Row_number() OVER(partition by o.name, oo.name ORDER BY o.name, oo.name) AS row
      FROM sysdepends d
           INNER JOIN sysobjects o ON o.id = d.id
           INNER JOIN sysobjects oo ON oo.id = d.depid
     WHERE o.xtype = 'P'
)
SELECT proc_name, table_name
  FROM sp_list
 WHERE row = 1
 ORDER BY proc_name, table_name


2. 인덱스 조각화율 체크

SELECT a.index_id, name, avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID(N'Production.Product'), NULL, NULL, NULL) AS a
    JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;
GO


퍼왔음...

댓글을 달아 주세요