final class OptimizeTable
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE t, …: a request to reorganize the storage of tables.

Mirrors PT_optimize_table_stmt (Sql_cmd_optimize_table). Rule: MYSQL-OPTIMIZE-TABLE-001. Each table resolves by MYSQL-SERVER-TABLES-001 and its resolution is the relation fact of its MaintainedTable; a table named twice is NonUniqueTable. LOCAL is a synonym of NO_WRITE_TO_BINLOG, which is written. TABLE and TABLES are synonyms; TABLE is written. The server returns one row per table and message; its columns are MYSQL-ADMIN-ROWS-001. Source: https://dev.mysql.com/doc/refman/8.4/en/optimize-table.html. Status: Implemented.

Reading the requestdoctest
$statement = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('optimize table t');
    [$statement->toString(), !$statement->statement->noWriteToBinlog] // => ['OPTIMIZE TABLE t', true]

Properties§

public list<MaintainedTable> $tables
public bool $noWriteToBinlog

Methods§

public function __construct(public bool $noWriteToBinlog, list<MaintainedTable> $tables)

Parameters

$noWriteToBinlogboolWhether NO_WRITE_TO_BINLOG or its synonym LOCAL is written
$tableslist<MaintainedTable>The tables in written order; at least one
Calls 2
public function deriveStatement(Derivation $derivation): void

Records the resolution of each table, reports a table named twice, and records the result rows.

Parameters

$derivationDerivation
Calls 4
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 2

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 checks 1