The effective maximum number of bytes that can be stored in a
subject to the maximum row size of 65,535 bytes, which is shared among all columns. For a
column that stores multi-byte characters, the effective maximum number of characters is less. For
example,
utf8
the
character set can be declared to be a maximum of 21,844 characters. See
utf8
"Limits on Table Column Count and Row
As of MySQL 5.0.3, the
column from a table in a MySQL Cluster will behave as follows:
VARCHAR
• If the size of the column is fewer than 256 characters, the column requires one byte extra storage per
row.
• If the size of the column is 256 characters or more, the column requires two bytes extra storage per
row.
The number of bytes required per character varies according to the character set used. For
example, if a
requires 3 bytes storage. This means that each record in such a column takes up 100 × 3 + 1 = 301
bytes for storage, regardless of the length of the string actually stored in any given record. For a
VARCHAR(1000)
set, each record will use 1000 × 3 + 2 = 3002 bytes storage; that is, the column is 1,000 characters
wide, each character requires 3 bytes storage, and each record has a 2-byte overhead because 1,000
>= 256.
and
TEXT
BLOB
row in a
TEXT
is actually stored in the original table. The other consists of any data in excess of 256 bytes, which
is stored in a hidden table. The rows in this second table are always 2,000 bytes long. This means
that the size of a
otherwise, the size is 256 +
The size of an
used for enumerations with up to 255 possible values. Two bytes are used for enumerations having
between 256 and 65,535 possible values. See
The size of a
object occupies
members. See
11.3. Choosing the Right Type for a Column
For optimum storage, you should try to use the most precise type in all cases. For example, if an
integer column is used for values in the range from
type. Of the types that represent all the required values, this type uses the least amount of storage.
Tables created in MySQL 5.0.3 and above use a new storage format for
calculations (+, -, *, and /) with
digits. See
Section 11.1.1, "Numeric Type
Prior to MySQL 5.0.3, calculations on
operations. If accuracy is not too important or if speed is the highest priority, the
good enough. For high precision, you can always convert to a fixed-point type stored in a BIGINT. This
enables you to do all calculations with 64-bit integers and then convert results back to floating-point
values as necessary.
PROCEDURE ANALYSE
information, see
11.4. Using Data Types from Other Database Engines
Choosing the Right Type for a Column
characters can require up to three bytes per character, so a
NDBCLUSTER
column in a Cluster table uses the
VARCHAR(100)
column in a table using the
columns are implemented differently in the NDB Cluster storage engine, wherein each
column is made up of two separate parts. One of these is of fixed size (256 bytes), and
column is 256 if
TEXT
+ (2000 –
size
object is determined by the number of different enumeration values. One byte is
ENUM
object is determined by the number of different set members. If the set size is N, the
SET
bytes, rounded up to 1, 2, 3, 4, or 8 bytes. A
(N+7)/8
Section 11.1.6.5, "The
DECIMAL
can be used to obtain suggestions for optimal column data types. For more
Section 8.8.2, "Using
Size".
engine supports only fixed-width columns. This means that a
storage engine with the
NDBCLUSTER
<= 256 (where
size
(size
– 256) % 2000).
Section 11.1.6.4, "The
Type".
SET
to 99999,
1
columns are done with precision of 65 decimal (base 10)
Overview".
values are performed using double-precision
DECIMAL
PROCEDURE
ANALYSE".
861
or
VARCHAR
VARBINARY
VARCHAR
character set, each character
utf8
represents the size of the row);
size
Type".
ENUM
can have a maximum of 64
SET
MEDIUMINT UNSIGNED
columns. All basic
DECIMAL
DOUBLE
column is
VARCHAR
column that uses
Section E.7.4,
character
utf8
is the best
type may be
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers