Thursday, March 02, 2006

SqlServer: indexes

Some points to remember about indexes in SqlServer 2000:
  • Primary key is a clustered unique index, but can be changed to non-clustered.
  • Clustered index: Data is physically sorted by the index. Important to keep the most selective column first in the index definition. Only one clustered index possible per table. If there is only one index on a table it should be clustered. Preferably the indexed column should contain a monotonically increasing value.
  • Non-clustered index: Symbolic links. Useful for single row look-ups. Can be up to 250 non-clustered indexes on a given table.
  • Select indexes based on perceived use of the table: what selects will be performed, what updates will be performed, etc.

No comments: