I have many tables where I have indexes on foreign keys, and clustered indexes which include those foreign keys. For example, I have a table like the following:
TABLE: Item
------------------------
id PRIMARY KEY
owner FOREIGN KEY
status
... many more columns
MySQL generates indexes for primary and foreign keys, but sometimes, I want to improve query performance so I'll create clustered or covering indexes. This leads to have indexes with overlapping columns.
INDEXES ON: Item
------------------------
idx_owner (owner)
idx_owner_status (owner, status)
If I dropped idx_owner
, future queries that would normally use idx_owner
would just use idx_owner_status
since it has owner
as the first column in the index.
Is it worth keeping idx_owner
around? Is there an additional I/O overhead to use idx_owner_status
even though MySQL only uses part of the index?
Edit: I am really only interested in the way InnoDB behaves regarding indexes.