MySQL – Arrange a table so that it shrinks as much as possible

MySQL

I'm a newbie and I have +10 million articles(200 to 1000 words) in a InnoDB table. I use this to select them:

SELECT article,title,other_fields from table where id=123;

There is no full-text search or any updates on article field.

How can I arrange the table so that the table size shrinks as much as possible. I'm happy with a little performance tradeoff. I'm sorry for the vague question but I couldn't find any answers online.

PS: There are inserts and updates on table, should I put article and id to a seperate table?

Best Answer

Here's general recommendations for keeping table size small

  • Try ROW_FORMAT=COMPRESSED when creating InnoDB tables. There will be impact on writes.
  • Use index with prefix
  • Use OPTIMIZE TABLE often if it gets many DELETE/UPDATE's

Normalizing tables would actually result in bigger overall size, but less. It MAY help with caching, though.