Having years of experience as a DBA, I do believe I know the answer to the question, but I figured it never hurts to check my bases.
Using SQL Server, assuming I have a
The first index covers queries that look up on A
, A,B
and the second index can be used to cover queries that look up on A
, A,B
or A,B,C
which is clearly a superset of the first case.
If C
is very wide however the index on A,B
may still be useful as it can satisfy certain queries with fewer reads.
e.g. if C
was a char(800)
column the following query may benefit significantly from having the narrower index available.
SELECT a,b
FROM YourTable
ORDER BY a,b