在設定 PostgreSQL 資料庫時經常會用到,節錄此表方便大家查詢:
Name | Storage Size | Description | Range |
---|
smallint | 2 bytes | small-range integer | -32768 to +32767 |
integer | 4 bytes | usual choice for integer | -2,147,483,648 to +2,147,483,647 |
bigint | 8 bytes | large-range integer | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
decimal | variable | user-specified precision, exact | no limit |
numeric | variable | user-specified precision, exact | no limit |
real | 4 bytes | variable-precision, inexact | 6 decimal digits precision |
double precision | 8 bytes | variable-precision, inexact | 15 decimal digits precision |
serial | 4 bytes | autoincrementing integer | 1 to 2147483647 |
bigserial | 8 bytes | large autoincrementing integer | 1 to 9223372036854775807 |
基本上常用的 integer 的大小是十億等級(2.1 billion),bigint (big integer) 是 92 萬兆(京)。
Reference:
http://www.postgresql.org/docs/8.3/static/datatype-numeric.html
Edited 2 time(s). Last edit at 02/11/2010 04:28PM by HP.
(
編輯記錄)