Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

Database User and Programming Tips

Posted May 3, 2018

Tables Without Clustered Indexes

By Greg Larsen

Do all of your tables contain clustered indexes?  Some say every table should have a clustered index.  Others say it depends.  When databases are being designed and developed, your developers might have overlooked creating clustered indexes on some of your database tables.  Having a useful clustered index on your tables will improve the performance of your queries, especially if you are returning data periodically in order by the clustered index key.  Here is a simple script to identify those tables in your database that don’t have a clustered index. 

-- Tables without clustered indexes
SELECT TOP 1000 o.name, i.type_desc, o.type_desc, o.create_date
FROM sys.indexes i
INNER JOIN sys.objects o
ON  i.object_id = o.object_id
WHERE o.type_desc = 'USER_TABLE'
AND i.type_desc = 'HEAP'
ORDER BY o.name;

See all articles by Greg Larsen

Database User and Programming Tips Archives