List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:May 25 2005 11:55am
Subject:Re: Storageformat of Decimal values ...
View as plain text  
Hi!

On May 24, Hagen H?pfner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Here it comes:
> 
> create table dec_test (a decimal(1,0)) type=myisam;
> insert into dec_test values(5);
> 
> dec_test.MYD --> FD 85 00 00 00
> 
> create table dec_test_20_10 (a decimal(20,10)) type=myisam;
> insert into dec_test_20_10 values(1234567899.1234567899)
> 
> dec_test_20_10.MYD -->
> FD 81 0D FB 38 DB 07 5B CD 15 09
> 
> Well, the 20_10-test seems to be correct now, but why uses MySQL 4
> Byte in the first examle? May this depend on the block size?

No, it depends on the "pointer" size. (not C pointer, but a pointer to a
record - a record number for a fixed row_format). In MyISAM a record
cannot be shorter than a pointer size. Try to create, say, 8 decimal
(1,0) fields, you'll see that every single one of then takes only one
byte.
 
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