List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:May 24 2005 3:37pm
Subject:Re: Storageformat of Decimal values ...
View as plain text  
Hi!

On May 24, Hagen H?pfner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Dear List,
> 
> I currently try to figure out, how decimal values are stored in MySQL. I
> read about the changes in 5.0.3 but could not comprehend it under 5.0.4
> beta. However,
> 
> http://dev.mysql.com/doc/mysql/en/precision-math-decimal-changes.html
> 
> mentioned, that 9 digits of a decimal value are stored in 4 byte. That
> means, that Decimal(18,9) as well as Decimal(1,0) requires 8 Byte (4 for
> the integer part and 4 for the fractional part).

DECIMAL(1,0) requires only one byte.

> A Decimal (20,10) should require one additional byte. So I created a
> MyISAM Table, inserted a value and looked at the hexdump. But the
> Decimal(20,10) value is also represented by 8 bytes.

It should take 10 bytes.
What was in your dump ?
 
Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/  www.mysql.com
Thread
Storageformat of Decimal values ...Hagen Höpfner24 May
  • Re: Storageformat of Decimal values ...Olaf van der Spek24 May
    • Re: Storageformat of Decimal values ...Hagen Höpfner24 May
  • Re: Storageformat of Decimal values ...Sergei Golubchik24 May
    • Re: Storageformat of Decimal values ...Hagen Höpfner24 May
      • Re: Storageformat of Decimal values ...Sergei Golubchik25 May
        • Re: Storageformat of Decimal values ...Hagen Höpfner25 May
          • Re: Storageformat of Decimal values ...Sergei Golubchik25 May