Rechercher dans le manuel MySQL
23.2.6 Subpartitioning
Subpartitioning—also known as
composite
partitioning—is the further division of each
partition in a partitioned table. Consider the following
CREATE TABLE
statement:
- SUBPARTITIONS 2 (
- );
Table ts
has 3 RANGE
partitions. Each of these
partitions—p0
, p1
,
and p2
—is further divided into 2
subpartitions. In effect, the entire table is divided into
3 * 2 = 6
partitions. However, due to the
action of the PARTITION BY RANGE
clause, the
first 2 of these store only those records with a value less than
1990 in the purchased
column.
It is possible to subpartition tables that are partitioned by
RANGE
or LIST
.
Subpartitions may use either HASH
or
KEY
partitioning. This is also known as
composite partitioning.
SUBPARTITION BY HASH
and
SUBPARTITION BY KEY
generally follow the
same syntax rules as PARTITION BY HASH
and
PARTITION BY KEY
, respectively. An
exception to this is that SUBPARTITION BY
KEY
(unlike PARTITION BY KEY
)
does not currently support a default column, so the column
used for this purpose must be specified, even if the table has
an explicit primary key. This is a known issue which we are
working to address; see
Issues with subpartitions, for
more information and an example.
It is also possible to define subpartitions explicitly using
SUBPARTITION
clauses to specify options for
individual subpartitions. For example, a more verbose fashion of
creating the same table ts
as shown in the
previous example would be:
- SUBPARTITION s0,
- SUBPARTITION s1
- ),
- SUBPARTITION s2,
- SUBPARTITION s3
- ),
- SUBPARTITION s4,
- SUBPARTITION s5
- )
- );
Some syntactical items of note are listed here:
Each partition must have the same number of subpartitions.
If you explicitly define any subpartitions using
SUBPARTITION
on any partition of a partitioned table, you must define them all. In other words, the following statement will fail:- SUBPARTITION s0,
- SUBPARTITION s1
- ),
- SUBPARTITION s2,
- SUBPARTITION s3
- )
- );
This statement would still fail even if it used
SUBPARTITIONS 2
.Each
SUBPARTITION
clause must include (at a minimum) a name for the subpartition. Otherwise, you may set any desired option for the subpartition or allow it to assume its default setting for that option.Subpartition names must be unique across the entire table. For example, the following
CREATE TABLE
statement is valid:- SUBPARTITION s0,
- SUBPARTITION s1
- ),
- SUBPARTITION s2,
- SUBPARTITION s3
- ),
- SUBPARTITION s4,
- SUBPARTITION s5
- )
- );
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-partitioning-subpartitions.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.