Bug #20431 VARDECIMAL
Submitted: 13 Jun 2006 16:33 Modified: 15 Jun 2006 18:12
Reporter: Dean Swift Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.22 OS:Linux (SUSE10)
Assigned to: CPU Architecture:Any

[13 Jun 2006 16:33] Dean Swift
Description:
When defining large precision columns, such as DECIMAL(18), much of the space is wasted unless the full range of digits is required in every row. Given the precedence of CHAR and VARCHAR, it seems logical to extend this to VARDECIMAL. Furthermore, implementation is envisioned to be similar.

Obviously, performance would be impacted if this was the only variable width field in a row. However, where VARCHAR is already in operation, VARDECIMAL would be a distinct boon.

How to repeat:
mysql> CREATE TABLE t8 (
    ->   a INT PRIMARY KEY,
    ->   b VARDECIMAL(18)
    -> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARDECIMAL(18)
)' at line 3

Suggested fix:
Until VARDECIMAL is implemented, continue using the DECIMAL datatype.
[15 Jun 2006 18:12] Valeriy Kravchuk
According to http://dev.mysql.com/doc/refman/5.0/en/precision-math-decimal-changes.html DECIMAL(18) will need 8 bytes only. I am not sure that any implementation of VARDECIMAL will change this dramatically in most cases (note that 1 additional byte or so will be needed to store real "length"). I do not know any other RDBMS that supports similar data type... So, I am not sure that this feature should be implemented.