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

VACUUM: a request to reclaim storage and optionally analyze tables.

Rule: PG-VACUUM-001. Mirrors PostgreSQL's VacuumStmt with is_vacuumcmd: the options in the order written and the tables, where no table stands for every table of the database. The older syntax writes FULL, FREEZE, VERBOSE and ANALYZE as words in that order. Facts: each table is resolved, and a listed column is looked up in a declared table. Diagnostics: an option VACUUM does not know; a value the option cannot take; the combinations of options PG-VACUUM-OPTIONS-001 lists, among them a column list without ANALYZE; a column the declared table does not have. Source: https://www.postgresql.org/docs/17/sql-vacuum.html. Status: Implemented.

Reading a VACUUM written with wordsdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('VACUUM FULL ANALYZE t');
    [$operation->statement->options[1]->option(), $operation->statement->targets[0]->table->name->value, $operation->toString()] // => ['analyze', 't', 'VACUUM FULL ANALYZE t']
Refusing words in another order than the grammar readsdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\Vacuum([
        new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\UtilityOption(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('verbose')),
        new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\UtilityOption(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('full')),
    ], \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\OptionSyntax::Words) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

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

Methods§

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

Parameters

$optionslist<UtilityOption>The options in the order written
$syntaxOptionSyntaxHow the options are written
$targetslist<MaintenanceTarget>The tables; none stands for every table
Calls 7
public function deriveStatement(Derivation $derivation): void

Resolves the tables and columns and reports what VACUUM rejects.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 4

Test cases 3§

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 2

Relations§

Instantiated in 2