classVacuum
final class Vacuum
implements Statement
uses Snapshot
@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.
$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']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\InvalidConstructionProperties§
public list<UtilityOption> $optionspublic list<MaintenanceTarget> $targetspublic OptionSyntax $syntax = OptionSyntax::WordsMethods§
public function __construct(
list<UtilityOption> $options = [],
public OptionSyntax $syntax = OptionSyntax::Words,
list<MaintenanceTarget> $targets = [],
)Parameters
$options | list<UtilityOption> | The options in the order written |
$syntax | OptionSyntax | How the options are written |
$targets | list<MaintenanceTarget> | The tables; none stands for every table |
Calls 7
- class-const OptionSyntax::Words() line 58
- static-call Check::listOf() line 60
- class-const UtilityOption::class() line 60
- class-const MaintenanceTarget::class() line 61
- static-call Check::input() line 62
- method-call OptionRules::writable() line 62
- new OptionRules line 62
public function deriveStatement(Derivation $derivation): voidResolves the tables and columns and reports what VACUUM rejects.
Parameters
$derivation | Derivation |
Calls 6
- method-call OptionRules::derive() line 70
- new OptionRules line 70
- method-call MaintenanceFacts::targets() line 71
- new MaintenanceFacts line 71
- method-call VacuumChecks::check() line 72
- new VacuumChecks line 72
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 80
- method-call OptionRules::write() line 81
- new OptionRules line 81
- method-call Output::list() line 82
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
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:98
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:99