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

ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE t, … [histogram]: a request to update the key distribution statistics of tables, or their histograms.

Mirrors PT_analyze_table_stmt (Sql_cmd_analyze_table). Rule: MYSQL-ANALYZE-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. A histogram request is checked against the one table by MYSQL-HISTOGRAM-001. 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/analyze-table.html. Status: Implemented.

Reading the requestdoctest
$statement = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('analyze local tables t, shop.u');
    [$statement->toString(), $statement->statement->noWriteToBinlog] // => ['ANALYZE NO_WRITE_TO_BINLOG TABLE t, shop.u', true]

Properties§

public list<MaintainedTable> $tables
public bool $noWriteToBinlog
public Histogram|null $histogram = null

Methods§

public function __construct(
    public bool $noWriteToBinlog,
    list<MaintainedTable> $tables,
    public Histogram|null $histogram = null,
)

Parameters

$noWriteToBinlogboolWhether NO_WRITE_TO_BINLOG or its synonym LOCAL is written
$tableslist<MaintainedTable>The tables in written order; at least one
$histogramHistogram|nullThe histogram request, when written (MySQL 8.0 and later)
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 6
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 3

Test cases 2§

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

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Type checks 1