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)?
+5
A:
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.
cletus
2009-08-07 00:13:03
+1
A:
Just import eg. 100 rows from the CSV. you will get a size for this db including the needed space for indexes. now you can calc up to your estimated rows from the csv. But dont take this numbers to the point, its just an approximation.
Rufinus
2009-08-07 00:18:38
+1
A:
If you want to get more exact see this MySQL Manual reference.
Note that if you are using characters sets such as UTF-8 (for Unicode) you may be averaging more than one byte per character in your strings.
Eric J.
2009-08-07 00:24:26