How do I know how much space I need for the mysql database


Let's say I'm importing multiple csv files into mysql. How can I find out how much space I need for this database (and as far as i noticed it doesn't seem to be the same size like csv files size)?

Back of the envelope estimation combined with basic knowledge of data type storage requirements.

For example, CSV file contains:

  • 300k customers;
  • Each customer has first name, last name, address and telephone;
  • Generally you'll need one byte per character (plus one) for a string;
  • Estimate that about 200 characters will be enough to store the above info;
  • 300k * 200 bytes = 60M of data;
  • Add overhead of about 10-20% for indexes, etc;
  • If you anticipate growth, factor that in now. Let's say it'll be 600k within a year;
  • 2 * 60M (doubling) * 1.2 = 144M.

And there you have an estimate.