Rechercher dans le manuel MySQL
23.3.2 Management of HASH and KEY Partitions
Tables which are partitioned by hash or by key are very similar to one another with regard to making changes in a partitioning setup, and both differ in a number of ways from tables which have been partitioned by range or list. For that reason, this section addresses the modification of tables partitioned by hash or by key only. For a discussion of adding and dropping of partitions of tables that are partitioned by range or list, see Section 23.3.1, “Management of RANGE and LIST Partitions”.
You cannot drop partitions from tables that are partitioned by
HASH
or KEY
in the same
way that you can from tables that are partitioned by
RANGE
or LIST
. However,
you can merge HASH
or KEY
partitions using ALTER TABLE ... COALESCE
PARTITION
. Suppose that a clients
table containing data about clients is divided into 12
partitions, created as shown here:
- id INT,
- )
- PARTITIONS 12;
To reduce the number of partitions from 12 to 8, execute the
following
ALTER
TABLE
statement:
COALESCE
works equally well with tables that
are partitioned by HASH
,
KEY
, LINEAR HASH
, or
LINEAR KEY
. Here is an example similar to the
previous one, differing only in that the table is partitioned by
LINEAR KEY
:
- -> )
- -> PARTITIONS 12;
- Query OK, 0 rows affected (0.03 sec)
- Query OK, 0 rows affected (0.06 sec)
The number following COALESCE PARTITION
is
the number of partitions to merge into the remainder—in
other words, it is the number of partitions to remove from the
table.
Attempting to remove more partitions than are in the table results in an error like this one:
To increase the number of partitions for the
clients
table from 12 to 18, use
ALTER TABLE ... ADD PARTITION
as shown here:
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-management-hash-key.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.