classAnalyzeTable
final class AnalyzeTable
implements Statement
uses Snapshot
@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.
$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> $tablespublic bool $noWriteToBinlogpublic Histogram|null $histogram = nullMethods§
public function __construct(
public bool $noWriteToBinlog,
list<MaintainedTable> $tables,
public Histogram|null $histogram = null,
)Parameters
$noWriteToBinlog | bool | Whether NO_WRITE_TO_BINLOG or its synonym LOCAL is written |
$tables | list<MaintainedTable> | The tables in written order; at least one |
$histogram | Histogram|null | The histogram request, when written (MySQL 8.0 and later) |
Calls 2
- method-call MaintainedTables::checked() line 47
- new MaintainedTables line 47
public function deriveStatement(Derivation $derivation): voidRecords the resolution of each table, reports a table named twice, and records the result rows.
Parameters
$derivation | Derivation |
Calls 6
- method-call MaintainedTables::derive() line 56
- new MaintainedTables line 56
- method-call Histograms::derive() line 58
- new Histograms line 58
- method-call AdminRows::admin() line 60
- new AdminRows line 60
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 3
- method-call MaintainedTables::render() line 68
- new MaintainedTables line 68
- method-call Output::node() line 69
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.