1dg618
2011-10-25 22:46:08 UTC
I created two similar tables. I created a unique clusterd index on
both tables, but the order of the columns are different. One index has
the date first where the other index has the date last. I'm searching
the tables using the date...
++++++
unique clustered index
date
first_id
second_id
I get this in the plan:
Positioning by key.
Keys are:
++++++
unique clustered index
first_id
second_id
date
I get this in the query plan:
Positioning by key.
Index contains all needed columns. Base table will not be read.
Keys are:
I noticed that I get the "Index contains all needed columns. Base
table will not be read." which is better performance-wise then not
getting it.
When creating indexes how do you guarantee not reading the base table.
It seems like the first case did have to read the base table?
both tables, but the order of the columns are different. One index has
the date first where the other index has the date last. I'm searching
the tables using the date...
++++++
unique clustered index
date
first_id
second_id
I get this in the plan:
Positioning by key.
Keys are:
++++++
unique clustered index
first_id
second_id
date
I get this in the query plan:
Positioning by key.
Index contains all needed columns. Base table will not be read.
Keys are:
I noticed that I get the "Index contains all needed columns. Base
table will not be read." which is better performance-wise then not
getting it.
When creating indexes how do you guarantee not reading the base table.
It seems like the first case did have to read the base table?