suppose you have a sql query select * from table where id=xxxx order by time
that has two indexes on this table, one is an id clustered index and the other is a time nonclustered index.
so let"s assume that it is forced to take the time nonclustered index , then the first step in executing this sql is to take out the sorted leaf nodes directly. The data field of this leaf node holds the primary key name, id. So the question is, the next step is to match the where condition, whether to where match id, directly on the data field of the leaf node of the time index, or to get the id and then get the row data through the primary key index to where match id?
think: select * from table where time=xxxx order by time
, what will happen? If the answer to the above question is the former (where matches id), directly on the data field of the leaf node of the time index, then the query efficiency of this sql and the above sql should be about the same?