Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know, that it is not a good design to set too many indexes, but just for understanding the theory:
What exactly are the disadvantages if you add an index on all columns in a table in MySQL?

  • Are the queries getting slower if I have indexes on columns, that i rarely use?
  • Are the inserts somewhat slower?
  • Is MySQL able to pick out the best index that speeds up the query?
share|improve this question
Do you mean index on all tables as per title or on all columns as per question? – Mark Apr 14 '13 at 21:57
  • Insert/Updates/Delete speed will degrade. The index has to be updated on data modification.
  • I don't know mysql in fine details but it also means more time spent by the query planner to determine the indexes to use.
  • More disk space.

These are the key disadvantages.

share|improve this answer
ok, so only the question left, if the planner needs more time – rubo77 Apr 14 '13 at 23:08
Well it will mean more time for the planner, it may not be a significant amount of time, it depends on your database, your server, how many other things it need to do. I.e. you may or may not see a difference speed wise. – ETL Apr 15 '13 at 0:03
@rubo77 it's not just a speed issue, greater complexity also means the planner is more likely to choose a poor plan. Good indexing makes the planner's job easier. – Jack Douglas Apr 15 '13 at 5:12
For example: if the table has just 5 varchar(255) columns and 4 million entries, would it slow down the planner significantly then, if there were indexes on all columns, compared to only indexes on the columns that are used in the query? – rubo77 Apr 15 '13 at 8:11
The short answer is: yes it will. Just like doing 1+1+1 is slower than doing 2+1. It's one more operation thus it's "slower". The longer answer is: it depends. Do you have other tables in your database or that's the only one? Are you using prepared statements or not? How fast is the server? In summary, you probably won't even notice the difference. But yes, it will be slower, maybe 0.001ms slower in this case. – ETL Apr 15 '13 at 13:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.