Would deleting old data from my tables improve MySQL query performance?

  • When my queries use indexes?
  • When my queries don't use indexes?
  • When I use InnoDB?
  • When I use MyISAM?

Maybe. It depends on many things, not all of them related to the factors you've listed above, including how many rows/much data you will be deleting and how much of your total data that represents, how normalized your data is and how many joins your queries perform, how well your queries are written, and probably several other factors.

EDIT: As an aside, it's better to scale to meet the data you have (e.g., by optimizing queries, adding or modifying indexes, upgrading hardware, etc.) than to scale back the data to meet the limitations of your system. There are exceptions, such as if the data you're deleting is itself a potential liability, like personal, financial, or health data that you are certain you have no further legitimate use for.

  • Nice answer. +1 for the edit. – user3914 Oct 3 '10 at 9:37
  • nice aside. that is a great attitude. – swxxii Oct 4 '10 at 21:52

After you delete old data, don't forget to optimize tables. (optimize table table_name;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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