Bug #50404 | DECIMAL(10,3) and DECIMAL(14,3) takes same space | ||
---|---|---|---|
Submitted: | 18 Jan 2010 6:30 | Modified: | 20 Jan 2010 9:03 |
Reporter: | Udai Gupta | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | Ver 14.14, 5.1.38 for Win32 on ia32 | OS: | Windows (XP SP3) |
Assigned to: | CPU Architecture: | Any |
[18 Jan 2010 6:30]
Udai Gupta
[18 Jan 2010 6:35]
Udai Gupta
Code I used for the experiment
Attachment: ExperimentDecimal.java (text/x-java), 1.05 KiB.
[19 Jan 2010 8:48]
Sveta Smirnova
Thank you for the report. But these calculations can be applied for MyISAM only, because every storage engie uses own representation of data. With MyISAM I get correct results: $ls -lah data/test/ .... -rw-rw---- 1 apple apple 68K 19 янв 11:45 table_1.MYD -rw-rw---- 1 apple apple 1K 19 янв 11:45 table_1.MYI -rw-rw---- 1 apple apple 8K 19 янв 11:45 table_1.frm -rw-rw---- 1 apple apple 78K 19 янв 11:45 table_2.MYD -rw-rw---- 1 apple apple 1K 19 янв 11:45 table_2.MYI -rw-rw---- 1 apple apple 8K 19 янв 11:45 table_2.frm
[20 Jan 2010 7:01]
Sveta Smirnova
Additional explanation to previous comment: I mean it is easy not see how much space takes a field using only MyISAM storage engines and this space is not exact: see bug #50286 for example how additional byte indicating if column can store NULLs changes data file size. Please note other storage engines can have own row overhead. For MyISAM and InnoDB you can consult MySQL Internals manual located at http://forge.mysql.com/wiki/MySQL_Internals
[20 Jan 2010 9:03]
Udai Gupta
Thanks Sveta Smirnova, I had this bubble in my mind that the mysql behavior should be same in terms of storage, never thought there could be engine specific storage behavior difference. I will try to understand innodb more thoroughly.