Index based on another index Assume a mysql table with columns A, B, C, ... .

There are one composite index based on columns A+B+C. Combination of values A, B and C is unique, so this index forms the primary key.

Now, a second index is need. There are two possibilities for this one: a) A+B+D+E; b) D+E.

I wonder which one of the previous options for the second index is better. Any hint is welcome.

Thanks.
As you gave no details of what you want to accomplish to base any hints on, I can tell you only the generic stuff:

If it is InnoDB then each secondary key contains the primary key values to find the right rows, so (a,b,d,e) is extended to (a,b,d,e,c) and (d,e) to (d,e,a,b,c) - as you can see, the columns indexed are the same but the order is not, and order of columns in multicolumn index is as important as the actual columns so those two are quite different in their effects.

If it is MyISAM, then the extension does not apply, each index references the row by a pointer to heap, so the indexes are totally different.

There is no universal notion of "better", it depends on what do you need the indexes for. Query speedup? Or are they supposed to be unique?