final class MaintainPartitions
    implements StandaloneCommand
    uses Snapshot
Public API: explicitly declared with @visibility public.

REBUILD | OPTIMIZE | ANALYZE | CHECK | REPAIR | TRUNCATE PARTITION ALL | p, …: a maintenance operation on partitions.

Mirrors PT_alter_table_rebuild_partition, …_optimize_partition, …_analyze_partition, …_check_partition, …_repair_partition and …_truncate_partition. LOCAL and NO_WRITE_TO_BINLOG are synonyms. The grammar of 5.6 and 5.7 reads NO_WRITE_TO_BINLOG a second time after the partitions of OPTIMIZE; the server ignores that second one, but it is part of the statement as written and is kept. Source: https://dev.mysql.com/doc/refman/8.4/en/partitioning-maintenance.html, https://github.com/mysql/mysql-server/blob/mysql-5.7.44/sql/sql_yacc.yy (OPTIMIZE PARTITION_SYM).

Rebuilding every partitiondoctest
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t REBUILD PARTITION ALL');
    [$alter->statement->commands[0]->kind, $alter->toString()] // => [\SqlSemantics\Platform\MySql\Statement\Alter\Partition\MaintenanceKind::Rebuild, 'ALTER TABLE t REBUILD PARTITION ALL']

Properties§

public list<CheckOption>|list<RepairOption> $options
public bool $local
public PartitionSelection $partitions
public bool $ignoredLocal = false

Methods§

public function __construct(
    public MaintenanceKind $kind,
    public bool $local,
    public PartitionSelection $partitions,
    list<CheckOption>|list<RepairOption> $options = [],
    public bool $ignoredLocal = false,
)

Parameters

$kindMaintenanceKindThe operation
$localboolWhether NO_WRITE_TO_BINLOG or LOCAL is written before the partitions
$partitionsPartitionSelectionThe partitions
$optionslist<CheckOption>|list<RepairOption>The options of CHECK or REPAIR in order
$ignoredLocalboolWhether NO_WRITE_TO_BINLOG or LOCAL is written after the partitions of OPTIMIZE (5.6, 5.7)
Calls 8
public function deriveCommand(Derivation $derivation, Environment $scope): void

Derives nothing: the action holds no expression.

Parameters

$derivationDerivation
$scopeEnvironment
public function render(Output $out): void

Writes the action.

Parameters

$outOutput
Calls 3

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type declarations 1