>> Yes, but it's not stored in UTC in MySQL and it consumes 8 bytes (never
>> have figured out why since TIME and DATE each only use 3 bytes) whereas,
>> currently, TIMESTAMP only stores 4 bytes.
>
> Different byte-packing strategies (from manual):
>
> DATE: A three-byte integer packed as DD + MM×32 + YYYY×16×32
> TIME: A three-byte integer packed as DD×24×3600 + HH×3600 + MM×60 + SS
> DATETIME: Eight bytes:
>  *  A four-byte integer packed as YYYY×10000 + MM×100 + DD
>  *  A four-byte integer packed as HH×10000 + MM×100 + SS
>
> The reason for this is because the data has to be packed into a byte
> structure so that when read, indexes can access each "part" of the date/time
> separately by simply dividing or bit-shifting the contents of the field.
>
> I'm not sure if there is a better way of packing the pieces of a datetime
> into a smaller structure, but of course, always open to suggestions...
>

Yes, there is.  SQL Server does it, though exactly how it does it
eludes me.  (I also thing SQL Server doesn't have microsecond
granularity; seems like it's 3 microseconds +/- or something like
that.)

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to