hello,
there are many indexes clustered an non clustered .so how can i see the result of each index, clustered and non clustered seperately through (T-SQL)
pls guide me.
RINO
Software/Hardware used:
sqlserver
ASKED:
June 3, 2010 12:21 PM
UPDATED:
June 8, 2010 4:04 AM
What do you mean by “the result of each index” ?
Rino, an index is a database object, not an operation, and thus, it doesn’t have a ‘result’. That’s why I asked for clarification.
Thnx sir ,
For giuding me and clearing out my doubt .
i also want to know if i m using clustered and non-clustered index on the same table then
which index will be used clustered or non-clustered.
Thanx.
Which index will be used will be determined by the Query Optimizer in SQL Server.
If you are executing a query that could use EITHER a clustered or a non-clustered index, and the query optimizer determines that the “cost” is roughly equivalent, then it should normally use the clustered index. However, it could determine that the non-clustered index would result in better performance.
Example – assume a simple table and indexes:
This query should use the clustered index – not necessarily because it is clustered, but because the index matches the query criteria.
This query should use the non-clustered index, for obvious reasons.
..
This query COULD use either index (or BOTH indexes!). Depending on the distribution of data in the two columns, the query optimizer could choose to use either index. If the data in “col2data” was highly discriminant (lots of different data values), while the data in “col1data” was “clumped”, then the non-clustered index may give better performance.
Thnx sir,
for the query response from u .
thnx.