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

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
SQL Scripts & Samples
Tips
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:



News Via RSS Feed


Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

Database User and Programming Tips

Posted May 3, 2018

WEBINAR:
On-Demand

Virtual Developer Workshop: Containerized Development with Docker


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;
GO

See all articles by Greg Larsen



Database User and Programming Tips Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.