Is it OK to name a MySQL index the same as the column it indexes?

sqlman picture sqlman · Jun 27, 2011 · Viewed 14.6k times · Source

Is it considered bad form to give an index the same name as the column it is based on?

Like if you have a column named 'foo' and you want to create a normal index on it, would it be okay to name the index 'foo'? MySQL doesn't complain, but I am wondering what the pros and cons are.

Answer

OMG Ponies picture OMG Ponies · Jun 27, 2011

The convention doesn't matter so much as that you are consistently using it.

That said, I prefix index names with "ind_"; Constraints get the "cns_" prefix. In either case, the column name(s, if composite/covering).