classAnalyze
final class Analyze
implements Statement
uses Snapshot
@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.
$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']new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\Analyze(\SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\OptionKeyword::Format) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public list<UtilityOption> $optionspublic list<MaintenanceTarget> $targetspublic OptionKeyword $keyword = OptionKeyword::Analyzepublic OptionSyntax $syntax = OptionSyntax::WordsMethods§
public function __construct(
public OptionKeyword $keyword = OptionKeyword::Analyze,
list<UtilityOption> $options = [],
public OptionSyntax $syntax = OptionSyntax::Words,
list<MaintenanceTarget> $targets = [],
)Parameters
$keyword | OptionKeyword | The spelling of the command: ANALYZE or ANALYSE |
$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 9
- class-const OptionKeyword::Analyze() line 54
- class-const OptionSyntax::Words() line 54
- static-call Check::input() line 56
- class-const OptionKeyword::Format() line 56
- static-call Check::listOf() line 57
- class-const UtilityOption::class() line 57
- class-const MaintenanceTarget::class() line 58
- method-call OptionRules::writable() line 59
- new OptionRules line 59
public function deriveStatement(Derivation $derivation): voidResolves the tables and columns and reports what ANALYZE rejects.
Parameters
$derivation | Derivation |
Calls 4
- method-call OptionRules::derive() line 67
- new OptionRules line 67
- method-call MaintenanceFacts::targets() line 68
- new MaintenanceFacts line 68
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 76
- method-call OptionRules::write() line 77
- new OptionRules line 77
- method-call Output::list() line 78
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
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:100
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:101