Friday, March 30, 2012

Index SQL Server

How do i use Index's in SQL Server to sort coulmn values....can someone give me some insight or any good links that would explain this for me please!!

You don't, exactly. It is true that clustered indexes do sort data in a given order, but indexes are basically used to look up values in a SQL Server. The keys are in fact sorted in a given order (ascending or descending) for easy access to data via a B-Tree structure, so they can have some value in sorting, but you wouldn't really sort using an index.

Data is sorted for output by the means of an ORDER BY clause of a SELECT statement. In some cases, when you are sorting in the same order as the clustered index, or when you only need the columns that make up an indexes keys, the index can be useful. But, indexes are also bad for the performance of writes, so you have to be careful to balance the use of indexes with write performance.

sql

No comments:

Post a Comment