In MySQL 8.4, partitioning support is not actually
provided by the MySQL Server, but rather by a table storage
engine's own or native partitioning handler. In MySQL
8.4, only the InnoDB
and NDB
storage engines provide
native partitioning handlers. This means that partitioned tables
cannot be created using any other storage engine than these.
(You must be using MySQL NDB Cluster with the
NDB
storage engine to create
NDB
tables.)
InnoDB storage engine.
InnoDB
foreign keys and MySQL
partitioning are not compatible. Partitioned
InnoDB
tables cannot have foreign key
references, nor can they have columns referenced by foreign
keys. InnoDB
tables which have or which are
referenced by foreign keys cannot be partitioned.
ALTER
TABLE ... OPTIMIZE PARTITION
does not work correctly
with partitioned tables that use InnoDB
. Use
ALTER TABLE ... REBUILD PARTITION
and
ALTER TABLE ... ANALYZE PARTITION
, instead,
for such tables. For more information, see
Section 15.1.9.1, “ALTER TABLE Partition Operations”.
User-defined partitioning and the NDB storage engine (NDB Cluster).
Partitioning by KEY
(including
LINEAR KEY
) is the only type of
partitioning supported for the
NDB
storage engine. It is not
possible under normal circumstances in NDB Cluster to create
an NDB Cluster table using any partitioning type other than
[LINEAR
] KEY
, and
attempting to do so fails with an error.
The maximum number of partitions that can be defined for an
NDB
table depends on the number of
data nodes and node groups in the cluster, the version of the
NDB Cluster software in use, and other factors. See
NDB and user-defined partitioning,
for more information.
The maximum amount of fixed-size data that can be stored per
partition in an NDB
table is 128 TB.
Previously, this was 16 GB.
CREATE TABLE
and
ALTER
TABLE
statements that would cause a user-partitioned
NDB
table not to meet either or
both of the following two requirements are not permitted, and
fail with an error:
The table must have an explicit primary key.
All columns listed in the table's partitioning expression must be part of the primary key.
Exception.
If a user-partitioned NDB
table
is created using an empty column-list (that is, using
PARTITION BY KEY()
or PARTITION BY
LINEAR KEY()
), then no explicit primary key is
required.
Partition selection.
Partition selection is not supported for
NDB
tables. See
Section 26.5, “Partition Selection”, for more
information.
Upgrading partitioned tables.
When performing an upgrade, tables which are partitioned by
KEY
must be dumped and reloaded.
For information about converting MyISAM
tables to InnoDB
, see
Section 17.6.1.5, “Converting Tables from MyISAM to InnoDB”.