Exact numeric data types
You use numeric data types to store numbers. The following table describes the integer numeric types in various ranges. The larger the range, the more storage it requires.
Type | Value | Disk usage |
---|---|---|
byteint (alias int1) | 8-bit values in range -128 to 127 | 1 byte |
smallint (alias int2) | 16-bit values in range -32,768 to 32,767 | 2 bytes |
integer (alias int and int4) | 32-bit values in range -2,147,483,648 to 2,147,483,647 | 4 bytes |
bigint (alias int8) | 64-bit values in range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | 8 bytes |
Type | Value | Disk usage |
---|---|---|
numeric(p, s) | Numeric with precision p and scale s. Precision can range from 1 to 38, scale from 0 to the precision. | Precision of 9 or less (4 bytes) Precision of 10 - 18 (8 bytes) Precision of 19 - 38 (16 bytes) |
numeric(p) | Equivalent to numeric(p, 0). | |
numeric | Equivalent to numeric(18, 0). | 8 bytes |
decimal | Although decimal is sometimes a distinct SQL data type, Netezza Performance Server SQL treats it as an alias for numeric. | 4 bytes to 16 bytes |
Always use the smallest integer or fixed-point numeric data type whenever possible. When you are converting source data to the Netezza Performance Server system, you might need to analyze the data to determine the smallest data type that you can use.
SELECT MIN(column_name), MAX(column_name) FROM table_name;