Skip to content

Add support for the ONLY option to VACUUM and ANALYZE in the Maintenance dialog. #9062 #9059 - #10838

Merged
dpage merged 2 commits into
pgadmin-org:masterfrom
dpage:fix/issue-9062-vacuum-analyze-only
Nov 27, 2026
Merged

dpage merged 2 commits into
pgadmin-org:masterfrom
dpage:fix/issue-9062-vacuum-analyze-only

Conversation

@dpage

@dpage dpage commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds an ONLY switch to the Maintenance dialog for VACUUM and ANALYZE, which renders VACUUM (...) ONLY schema.table / ANALYZE (...) ONLY schema.table so a parent table is processed without its inheritance children or partitions.
  • Gated with min_version: 180000 like the other version-specific options, and shown only when the dialog is opened on a table (hidden and cleared for databases, materialized views, REINDEX and CLUSTER). The template also emits ONLY only when a table is the target.
  • Documented in maintenance_dialog.rst.

Note that PostgreSQL 18 accepts VACUUM ONLY on a partitioned table but warns that it has no effect (a partitioned parent has no storage); ANALYZE ONLY there collects the parent's statistics, which is the main use case.

Test plan

  • regression/runtests.py --pkg tools.maintenance.tests.test_maintenance_create_job_unit_test on PostgreSQL 18 (new VACUUM ONLY / ANALYZE ONLY / ignored-without-table scenarios)
  • Jest maintenance.ui.spec.js (visibility, clearing and version gate of the new field), eslint on changed files
  • Generated statements checked by hand with psql against PostgreSQL 18

Closes #9062
Closes #9059

Summary by CodeRabbit

  • New Features
    • On PostgreSQL 18 and later, choose ONLY for VACUUM or ANALYZE on a selected table. The operation applies to that table only, excluding its inheritance children and partitions.
    • The option is available only for table-level VACUUM and ANALYZE operations; it is not available for other maintenance operations or database-level selections.
  • Documentation
    • Updated the maintenance guide to describe the ONLY option and its behavior.

…nce dialog. pgadmin-org#9062 pgadmin-org#9059

On PostgreSQL 18 and later, an ONLY switch is shown for VACUUM and ANALYZE
when the dialog is opened on a table, so that the parent table is processed
without its inheritance children or partitions.

Closes pgadmin-org#9062
Closes pgadmin-org#9059
@dpage dpage self-assigned this Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The maintenance dialog adds an ONLY option for table-level VACUUM and ANALYZE on PostgreSQL 18 and later. SQL generation includes ONLY when the option and a table are set. Tests and documentation cover the option’s applicability and generated commands.

Changes

Maintenance ONLY option

Layer / File(s) Summary
ONLY option applicability
web/pgadmin/tools/maintenance/static/js/maintenance.ui.js, web/regression/javascript/schema_ui_files/maintenance.ui.spec.js
The UI shows the ONLY switch for table VACUUM and ANALYZE operations. It disables and clears the option for other operations and node types. Tests check the version gate and applicability.
SQL generation and operation coverage
web/pgadmin/tools/maintenance/templates/maintenance/sql/command.sql, web/pgadmin/tools/maintenance/tests/test_maintenance_create_job_unit_test.py, docs/en_US/maintenance_dialog.rst
VACUUM and ANALYZE commands include ONLY when the option and a table are set. Tests cover table-level commands and database-level VACUUM. The documentation describes the option and its scope.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Merge Risk: Minimal · up to 6ee18

Adds an ONLY option for table-level VACUUM and ANALYZE on PostgreSQL 18 and later. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: adding the ONLY option to the VACUUM and ANALYZE operations in the Maintenance dialog. The changeset matches this: the UI field, the SQL generation, the documentation,…
Linked Issues check Passed Both directly linked issues require ONLY support for VACUUM and ANALYZE on PostgreSQL 18 and later. [#9062, #9059] The whole-PR summary shows: (1) maintenance.ui.js adds an ONLY field in VacuumSchema,…
Out of Scope Changes check Passed Each changed file supports the ONLY objectives. [#9062, #9059] maintenance.ui.js adds the switch, its version gate, and the isApplicableForOnly(state) applicability check. command.sql adds the ONLY cl…
Full details: Title check

Explanation

The title names the main change: adding the ONLY option to the VACUUM and ANALYZE operations in the Maintenance dialog. The changeset matches this: the UI field, the SQL generation, the documentation, and the tests all cover ONLY for VACUUM and ANALYZE on tables. The title also cites issues #9062 and #9059, which the linked objectives match. The title is specific and short enough to convey the primary change.

Full details: Linked Issues check

Explanation

Both directly linked issues require ONLY support for VACUUM and ANALYZE on PostgreSQL 18 and later. [#9062, #9059] The whole-PR summary shows: (1) maintenance.ui.js adds an ONLY field in VacuumSchema, gated by min_version 180000 (PostgreSQL 18.0); (2) command.sql emits VACUUM and ANALYZE with ONLY when data.only and data.table are set; (3) test_maintenance_create_job_unit_test.py adds VACUUM ONLY and ANALYZE ONLY table scenarios with minimum version 18.0; (4) maintenance.ui.spec.js covers visibility, enabled state, clearing, and the version gate. The assessment relies on the summary and PR description. I did not read the diff hunks. The summary is specific enough to establish the required behavior. No coding requirement is unmet in the available evidence.

Full details: Out of Scope Changes check

Explanation

Each changed file supports the ONLY objectives. [#9062, #9059] maintenance.ui.js adds the switch, its version gate, and the isApplicableForOnly(state) applicability check. command.sql adds the ONLY clause. The unit test and Jest spec verify the switch. maintenance_dialog.rst documents it. The UI hides and clears the field for databases, materialized views, REINDEX, CLUSTER, and partition selections. This limits the option to its intended targets. The summary lists no changed public declarations beyond the added method. No unrelated change appears in the available evidence. The incremental changes since the previous reviewed head were not separately inspected; the whole-PR summary was used.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0246f62 and 6ee18d7.

Files selected for processing: 2

  • web/pgadmin/tools/maintenance/static/js/maintenance.ui.js
  • web/regression/javascript/schema_ui_files/maintenance.ui.spec.js

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

The dialog files a selected partition's parent under 'table', so the
command would be VACUUM/ANALYZE ONLY on the partitioned parent, which
does nothing and skips the partition the user chose.
@dpage
dpage merged commit 9116afc into pgadmin-org:master Nov 27, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for VACUUM ONLY syntax Add support for ANALYZE ONLY (Maintainence)

1 participant