INTEGER/ BIGINT / SMALLINT / TINYINT
→ C/C++ Representation
FLOAT / REAL vs. NUMERIC / DECIMAL
→ IEEE-754 Standard / Fixed-point Decimals
VARCHAR / VARBINARY / TEXT / BLOB
→ Header with length, followed by data bytes.
TIME / DATE / TIMESTAMP
→ 32/64-bit integer of (micro)seconds since Unix epoch
FLOAT / REAL
Inexact, variable-precision numeric type that uses the "native" C/C++ types.
NUMERIC / DECIMAL
Numeric data types with (potentially) arbitrary
precision and scale. Used when rounding errors are unacceptable.
typedef unsigned char NumericDigit;
typedef struct {
int ndigits;
int weight;
int scale;
int sign;
NumericDigit *digits;
} numeric;
typedef int32 decimal_digit_t;
struct decimal_t {
int intg; /* # of Digits Before Point */
int frac; /* # of Digits After Point */
int len; /* Length (Bytes) */
bool sign;
decimal_digit_t *buf;
};
Most DBMSs don't allow a tuple to exceed the size of a single page.