Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In SQL standard there are no unsigned integers. So their support may be omitted. But should it become needed for some reason then a compressed unsigned integer must be zero-extended on decompression.

Date Field Representation

A date field occupies 3 bytes.

23222120191817161514131211109876543210
year - 15 bits as a signed two-complement number, that is 1 bit of them is a sign bitmonth - 4  bitsmonth day - 5 bits
byte 2byte 1byte 0

Time Field Representation

A time field may occupy 4, 5, or 6 bytes depending on the factional part precision that may  be up to a millisecond, microsecond,  and nanosecond respectively.

313029282726252423222120191817161514131211109876543210
padding - 5 zero bitshour - 5 bitsminute - 6 bitssecond - 6 bitsmilliseconds - 10 bits
byte 3byte 2byte 1byte 0


3938373635343332313029282726252423222120191817161514131211109876543210
3 zero bitshour - 5 bitsminute - 6 bitssecond - 6 bitsmicroseconds - 20 bits
byte 4byte 3byte 2byte 1byte 0


47464544434241403938373635343332313029282726252423222120191817161514131211109876543210
3 zero bitshour - 5 bitsminute - 6 bitssecond - 6 bitsmicroseconds - 20 bits
byte 5byte 4byte 3byte 2byte 1byte 0



Corollary

If the number of fields is N and t is an array that stores a binary tuple we can find the answers for the following:

...