FireBird数据库的库和数据类型极限参数

摘自firebird官方资料,ahe对关键地方简单翻译,若有谬误,请参考原文。

数据库限制

项目 Firebird 2.x Firebird 1.5.x
数据库最大尺寸 使用多个库文件存储条件下,理论上不限制数据库尺寸,目前已知的最大FB数据库为980 GB 使用多个库文件存储条件下 32 TB
单个数据库文件最大尺寸 多数操作系统下支持TB级库文件; 但受文件系统限制(比如某些操作系统下限制单个文件最大4 GB 或 2 GB) Same
数据库文件最大个数 64,535 Same
最大表数量 64,535 Same
单表最大尺寸 ~32 TB ~36 GB
外链表最大尺寸 2 GB Same
单表最大记录数 > 16 亿(超出此记录数尚未测试) ~4 Billion
注意: 此1 亿实际是 1024的三次方
最大记录尺寸 65,536 字节(64 KB) Same
数据库分页最大尺寸 16 KB Same
NOTE: Page size (PAGE_SIZE) can be 1024, 2048, 4096, 8192 or 16384. Size 1024 is not recommended.
每表最大字段数 取决于字段类型. (例如: 16,384 INTEGER (4-字节) 每行)(译者注:受64K最大记录尺寸限制)
NOTE: 8-byte ID is stored for each BLOB or ARRAY reference; size of BLOB or ARRAY data is not counted in row size.
每表最大索引树 65,535 Same
Maximum size (total width) of index key 4,096 bytes when page size is 16 KB (limited to 1/4 of database page size) 252 bytes
IMPORTANT: Limit decreases for character columns when character set is multi-byte; non-binary collation further reduces limit.
每数据库最大索引个数 4,398,046,511,104 Same


Data Type Specifics

Name Size Range/Precision Description
Varchar(n) n chars 1 to 32767 bytes Variable length char or text string. NB, multi-byte character sets reduce number of possible characters proportionately
Smallint 16 bits -2^15 to 2^15-1 Signed short (word)
Integer 32 bits -2^31 to 2^31-1 Signed long (longword)
Float 32 bits 3.4 x 10^-38 to 3.4 x 10^38 Accurate to 7 digits
Double Precision 64 bits 1.7 x 10^-308 to 1.7 x 10^308 Accurate to 15 digits
Timestamp  64 bits
(2 X 32 bits)
1 Jan 100 CE to 28 Feb 32768 CE Includes time and date as two 32-bit structures
Date 32 bits 1 Jan 100 CE to 28 Feb 32768 CE Date only. Time part is not stored.
Time 32 bits 0:00 to 23:59.9999
BLOB <32GB Stores data of variable indeterminate size
Numeric (precision, scale) Variable
(16, 32, or 64 bits)
specifies exactly precision digits of precision Example: Numeric(10,3) holds numbers accurately in the following format: ppppppp.sss
Decimal (precision, scale) Variable
(16, 32, or 64 bits)
specifies at least precision digits of precision Example: Decimal(10,3) holds numbers accurately in the following format: ppppppp.sss

Database Limits

Item Firebird 2.x Firebird 1.5.x
Maximum size of database Practically unlimited using multiple database files (largest known database is over 980 GB) 32 TB using multiple files
Maximum size of one database file Multiple terabytes on most platforms; limited by file systems (4 GB or 2 GB on some platforms) Same
Maximum number of database files 64,535 Same
Maximum number of tables 64,535 Same
Maximum size of one table ~32 TB ~36 GB
Maximum size of external table file 2 GB Same
Maximum number of rows per table > 16 Billion (not been measured beyond this) ~4 Billion
NOTE: 1 Billion is 1024³
Maximum row size 65,536 bytes (64 KB) Same
Maximum database page size 16 KB Same
NOTE: Page size (PAGE_SIZE) can be 1024, 2048, 4096, 8192 or 16384. Size 1024 is not recommended.
Maximum number of columns per table Depends on data types used. (Example: 16,384 INTEGER (4-byte) values per row.)
NOTE: 8-byte ID is stored for each BLOB or ARRAY reference; size of BLOB or ARRAY data is not counted in row size.
Maximum number of indexes per table 65,535 Same
Maximum size (total width) of index key 4,096 bytes when page size is 16 KB (limited to 1/4 of database page size) 252 bytes
IMPORTANT: Limit decreases for character columns when character set is multi-byte; non-binary collation further reduces limit.
Maximum number of indexes per database 4,398,046,511,104 Same

Data Type Specifics

Name Size Range/Precision Description
Varchar(n) n chars 1 to 32767 bytes Variable length char or text string. NB, multi-byte character sets reduce number of possible characters proportionately
Smallint 16 bits -2^15 to 2^15-1 Signed short (word)
Integer 32 bits -2^31 to 2^31-1 Signed long (longword)
Float 32 bits 3.4 x 10^-38 to 3.4 x 10^38 Accurate to 7 digits
Double Precision 64 bits 1.7 x 10^-308 to 1.7 x 10^308 Accurate to 15 digits
Timestamp  64 bits
(2 X 32 bits)
1 Jan 100 CE to 28 Feb 32768 CE Includes time and date as two 32-bit structures
Date 32 bits 1 Jan 100 CE to 28 Feb 32768 CE Date only. Time part is not stored.
Time 32 bits 0:00 to 23:59.9999
BLOB <32GB Stores data of variable indeterminate size
Numeric (precision, scale) Variable
(16, 32, or 64 bits)
specifies exactly precision digits of precision Example: Numeric(10,3) holds numbers accurately in the following format: ppppppp.sss
Decimal (precision, scale) Variable
(16, 32, or 64 bits)
specifies at least precision digits of precision Example: Decimal(10,3) holds numbers accurately in the following format: ppppppp.sss

发表评论