* Jonas Askås
> I'm wondering how well MySQL compress data. I'm about to design a
> database which will hold mainly _a lot_ of FLOAT-values, and since I do
> not really know how well MySQL compress data or how I could calculate
> this I'd really appriciate a little guidance.

mysql does not compress data by default, but you can use a tool to make a
compressed read only table, see the manual:

<URL: http://www.mysql.com/doc/en/myisampack.html >

> Here's an example of how much data could be stored in a year:
>
> 1 value/minute are stored = 1440 values/day.
> 365 days / year.
>
> We have 100 different tables with 25 columns each.
> This makes 100*25*365*1440 = 1 314 000 000 values per year.
>
> A typical value could be 25,5624.
>
> How much space (in Mb) could this take up after a year do you think?

A FLOAT occupies 4 or 8 bytes, depending on the precision.

1314000000 * 4 = 5012 Mb
1314000000 * 8 = 10025 Mb

However, you would normally need to store something more than just the float
value, otherwise it would be difficult to use the data for anything...
assuming you also need an integer pointer for each value, you would need 4
extra bytes per row, and mysql also occupies 1 byte for a deletion flag,
which will give you a total record length of 4+4+1=9 or 8+4+1=13.

1314000000 * 9 = 11278 Mb
1314000000 * 13 = 16290 Mb

This is the size of the data, an index will require additional space.

<URL: http://www.mysql.com/doc/en/Column_types.html >
<URL: http://www.mysql.com/doc/en/Storage_requirements.html >

--
Roger


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to