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

ANALYZE: a request to collect statistics about tables.

Rule: PG-ANALYZE-001. Mirrors PostgreSQL's VacuumStmt without is_vacuumcmd: the options in the order written and the tables with their columns, where no table stands for every table of the database. ANALYSE is the British spelling of the same command and is kept. The older syntax writes VERBOSE as a word. Facts: each table is resolved, and a listed column is looked up in a declared table. Diagnostics: an option ANALYZE does not know; a column the declared table does not have. Source: https://www.postgresql.org/docs/17/sql-analyze.html. Status: Implemented.

Reading an ANALYZE in the British spellingdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ANALYSE VERBOSE t');
    [$operation->statement->keyword, $operation->toString()] // => [\SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\OptionKeyword::Analyse, 'ANALYSE VERBOSE t']
Refusing a command keyword that is not a spelling of ANALYZEdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\Analyze(\SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\OptionKeyword::Format) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<UtilityOption> $options
public list<MaintenanceTarget> $targets
public OptionKeyword $keyword = OptionKeyword::Analyze
public OptionSyntax $syntax = OptionSyntax::Words

Methods§

public function __construct(
    public OptionKeyword $keyword = OptionKeyword::Analyze,
    list<UtilityOption> $options = [],
    public OptionSyntax $syntax = OptionSyntax::Words,
    list<MaintenanceTarget> $targets = [],
)

Parameters

$keywordOptionKeywordThe spelling of the command: ANALYZE or ANALYSE
$optionslist<UtilityOption>The options in the order written
$syntaxOptionSyntaxHow the options are written
$targetslist<MaintenanceTarget>The tables; none stands for every table
Calls 9
public function deriveStatement(Derivation $derivation): void

Resolves the tables and columns and reports what ANALYZE rejects.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 4

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 2