Storage Requirements for Numeric Types
859
the user, then a “hidden” primary key will be created by
NDB
. This hidden primary key consumes 31-35
bytes per table record.
You may find the
ndb_size.pl
utility to be useful for estimating
NDB
storage requirements. This
Perl script connects to a current MySQL (non-Cluster) database and creates a report on how much
space that database would require if it used the
NDBCLUSTER
storage engine. See
Section 17.4.18,
“
ndb_size.pl
— NDBCLUSTER Size Requirement Estimator”
, for more information.
Storage Requirements for Numeric Types
Data Type
Storage Required
TINYINT
1 byte
SMALLINT
2 bytes
MEDIUMINT
3 bytes
INT
,
INTEGER
4 bytes
BIGINT
8 bytes
FLOAT(p)
4 bytes if 0 <=
p
<= 24, 8 bytes if 25 <=
p
<= 53
FLOAT
4 bytes
DOUBLE [PRECISION]
,
REAL
8 bytes
DECIMAL(M,D)
,
NUMERIC(M,D)
Varies; see following discussion
BIT(M)
approximately (
M
+7)/8 bytes
The storage requirements for
DECIMAL
(and
NUMERIC
) are version-specific:
As of MySQL 5.0.3, values for
DECIMAL
columns are represented using a binary format that packs nine
decimal (base 10) digits into four bytes. Storage for the integer and fractional parts of each value are
determined separately. Each multiple of nine digits requires four bytes, and the “leftover” digits require
some fraction of four bytes. The storage required for excess digits is given by the following table.
Leftover Digits
Number of Bytes
0
0
1
1
2
1
3
2
4
2
5
3
6
3
7
4
8
4
Before MySQL 5.0.3,
DECIMAL
columns are represented as strings and storage requirements are:
M
+2
bytes if
D
> 0,
M+1
bytes if
D
= 0,
D
+2 if
M < D
Storage Requirements for Date and Time Types
Data Type
Storage Required
DATE
3 bytes
TIME
3 bytes
DATETIME
8 bytes
TIMESTAMP
4 bytes
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...