CIQUERY - technical support experts on software ,hardware,IT platforms  
 CIQUERY - technical support experts on software ,hardware,IT platforms IT Job search  CIQUERY - technical support experts on software ,hardware,IT platforms  
Register here | FAQ | All about CIQUERY | Technical Support Categories| ARTICLES|SQL Server Performance

Free SQL Server Tips

UK IT Jobs - www.itjobfeed.com

Rethinking SQL Server Indexes
SQL Server 2005 allows indexes to be created with included non-key columns (in non-clustered indexes). This development has encouraged me to start rethinking indexes (not automatically differentiating between clustered and non clustered indexes). e.g "table" contains one or greater key columns and one or greater non-key columns (columns covered by the index allowing the query processor to derive the values from the index rather than having to check another index or table).

At minimum a table contains an index, If the the index contains key columns it's a clustered index, if there are no key columns it's defined as a heap. It's useful to think of this index as a "table" , as it acts as a container for for all the data. Therefore an index contains: 1)none or greater key columns , 2)none or greater non-key columns , 3)a "row locator" for evry row linking the index row with the row in the table.

The row locator is one of the following 3: 1)the clustered key value if there is a unique clustered index on the table,2) the clustered key value plus an internal unique identifier, if there is a nonunique clustered index on the table, 3)if there's no clustered index,an internal row identifier for a row in the heap

An index explored by an ORDER BY or a WHERE on specific value is made useful by containing the columns in the ORDER BY or WHERE. An efficient query process is a balancing act between narrow indexes facilitating efficient searching and indexes that can cover the relevant joins, ORDER BY etc that allow the query to return relevant results.The key point to develop a mindset that makes you think about a "table" and related indexes in a similar way - i.e containers for non-key columns, key columns and row locators.

 

Digg This : Click to email a colleague


Author details
------------------------------------------------------------------------
Jack Vamvas is a SQL Server Consultant. To contact him about this article , or any issues related to SQL Server register on www.ciquery.com and post a question.
For SQL Server Consultancy of any SQL Server task - check SQL Server Specialists
Make SQL Server go faster - click here


© CIQUERY 2008Factsheet  |Blog  |Browse IT jobs  |Advertisers  | Job Tools  |Resources  |Companies  | Contact Us  | ITjobfeed Home