Thursday, November 1, 2018

SQL Prompt Code Analysis: Table Does Not Have Clustered Index (BP021)

With a few exceptions, every table should have a clustered index. However, they are not always essential for performance. The value of a clustered index depends on the way a table is used, the typical pattern of queries, and how it the table is updated. More important for a table is that it should have an appropriate primary key. If you cannot explain a good reason for avoiding a clustered index on a table, it is far safer to have one. Good reasons are hard to come by unless you know exactly how the table will be used.

Heaps and SQL Server

Heaps, which are tables without clustered indexes, are treated in SQL Server as the naughty sister of tables and they have, in the past, generally lived up to their reputation. In previous SQL Server versions, it was, for example, impossible to rebuild the indexes. The query response times increased as inserts and deletes happened to the table, because of forwarding pointers.



from DZone.com Feed https://ift.tt/2yQwaGH

No comments:

Post a Comment