Hi
I have a table that has a clustered index on the ID field.
If I do a select *, the optimizer returns all the rows, BUT, with the following 'weird' behaviour:
1- The returned list is NOT sorted. Actually 80% is sorted, the rest is not.
2- The Optimizer does a table scan EVEN if I specify a 'where' clause and limit the the ID to a range. (I.E. ID >= 10001)
My questions, why is the info NOT sorted and why the table scan ALL the time?
If I force the query optimizer to use the index, it omits the table scan, BUT, the info is still not sorted.
Is this normal? Is it possible that the Datapages are sorted but the data on each page is not 100% guaranteed to be sorted?
I await your wisdom.
-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR] and
[/ignore] tags.
Ex:
I have a table that has a clustered index on the ID field.
If I do a select *, the optimizer returns all the rows, BUT, with the following 'weird' behaviour:
1- The returned list is NOT sorted. Actually 80% is sorted, the rest is not.
2- The Optimizer does a table scan EVEN if I specify a 'where' clause and limit the the ID to a range. (I.E. ID >= 10001)
My questions, why is the info NOT sorted and why the table scan ALL the time?
If I force the query optimizer to use the index, it omits the table scan, BUT, the info is still not sorted.
Is this normal? Is it possible that the Datapages are sorted but the data on each page is not 100% guaranteed to be sorted?
I await your wisdom.
-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR] and
Code:
Ex:
Code:
SELECT 1 from sysobjects