Category Archives: Find Missing Clustered Indexes in SQL Server Database

Finding missing clustered indexes in SQL Server Database


Execute the following SQL Server script in Management Studio Query Analyzer to list tables
missing a clustered index.
 USE AdventureWorksDW;

SELECT   DISTINCT [Table] = object_name(object_id)

FROM     sys.indexes

WHERE    index_id = 0

         AND objectproperty(object_id,’IsUserTable’) = 1

         AND objectproperty(object_id,’IsMSShipped’) = 0

ORDER BY [Table]

GO
/* Results

Table

AdventureWorksDWBuildVersion

DatabaseLog

FactCurrencyRate

FactFinance

FactInternetSales

FactInternetSalesReason

FactResellerSales

FactSalesQuota

ProspectiveBuyer

*/

Advertisements
%d bloggers like this: