Skip to content

feat!: exclude backups from long running queries - #3790

Merged
sbosio merged 4 commits into
v12.0.0from
feat/exclude-backups-from-long-running-queries
Aug 12, 2026
Merged

feat!: exclude backups from long running queries#3790
sbosio merged 4 commits into
v12.0.0from
feat/exclude-backups-from-long-running-queries

Conversation

@ekozilforce

@ekozilforce ekozilforce commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

This pr adds a where clause to pg:long-running-queries to filter out backups that are expected, low impact, and not actionable for customers. This command is meant to provide clarity for debugging, so the existence of this query leads to customer confusion. Thepg:ps command will continue to show all active queries.

We'd like to ship this change in the v12 cli release.

Slack discussion for additional context: https://salesforce.enterprise.slack.com/archives/C1RU5S0G2/p1782485686544529.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

Notes:

Standard db Testing

ps shows all running queries. Below we see follower replication, backup, and user queries:

% ./bin/dev.js pg:ps postgresql-trapezoidal-38184 --app ekozil-dev
  pid   |        state        |      source      |    username    |   running_for   |       transaction_start       | waiting |                                                                               query                                                                                
--------+---------------------+------------------+----------------+-----------------+-------------------------------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------
 557810 | active              | psql interactive | ub7m0qjpm7g4mi | 00:08:16.344795 | 2026-06-26 14:03:10.928145+00 | t       | SELECT pg_sleep(36000);
 557739 | idle in transaction |                  | postgres       | 00:15:10.941238 | 2026-06-26 13:56:16.331702+00 | t       | SELECT file_name,   lpad(file_offset::text, 8, '0') AS file_offset FROM pg_walfile_name_offset(  pg_backup_start('freeze_start_2026-06-26T13:56:16.331605+00:00'))
 557712 | active              | follower         | postgres       |                 |                               | t       | START_REPLICATION 0/61000000 TIMELINE 1
(3 rows)

long-running-queries pre-implementation, we see the backup and follower queries:

% ./bin/dev.js pg:long-running-queries postgresql-trapezoidal-38184  --app ekozil-dev
  pid   |    duration     |                                                                               query                                                                                
--------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------
 557712 | 00:17:05.834817 | START_REPLICATION 0/61000000 TIMELINE 1
 557739 | 00:16:03.32151  | SELECT file_name,   lpad(file_offset::text, 8, '0') AS file_offset FROM pg_walfile_name_offset(  pg_backup_start('freeze_start_2026-06-26T13:56:16.331605+00:00'))
 557810 | 00:09:08.725209 | SELECT pg_sleep(36000);
(3 rows)

Post-implementation we only see the user query, filtering out the backup and follower queries:

% ./bin/dev.js pg:long-running-queries postgresql-trapezoidal-38184  --app ekozil-dev
  pid   |    duration     |         query          
--------+-----------------+------------------------
 557810 | 00:08:47.514534 | SELECT pg_sleep(36000);
(1 row)


Post-implementation smoke tests for essential and advanced show the command runs without error:

% ./bin/dev.js pg:long-running-queries postgresql-pointy-19471 --app ekozil-dev   
(node:54131) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
 pid | duration | query 
-----+----------+-------
(0 rows)


./bin/dev.js pg:long-running-queries postgresql-octagonal-04440 --app ekozil-dev          
(node:50829) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
 pid | duration | query 
-----+----------+-------
(0 rows)

Screenshots (if applicable)

Related Issues

GUS work item: W-22101694

@ekozilforce ekozilforce changed the title feat/exclude-backups-from-long-running-queries feat: exclude-backups-from-long-running-queries Jun 25, 2026
@ekozilforce ekozilforce changed the title feat: exclude-backups-from-long-running-queries feat: exclude backups from long running queries Jun 25, 2026
Comment thread test/unit/commands/pg/long-running-queries.unit.test.ts

@subakva subakva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I hope this reduces some confusion about expected background processes.

@ekozilforce
ekozilforce marked this pull request as ready for review June 26, 2026 14:49
@ekozilforce
ekozilforce requested a review from a team as a code owner June 26, 2026 14:49
@ekozilforce ekozilforce changed the title feat: exclude backups from long running queries feat!: exclude backups from long running queries Jun 30, 2026
@ekozilforce

Copy link
Copy Markdown
Contributor Author

I chatted with @k80bowman and updated the pr title and description that this is a breaking change.

@ekozilforce
ekozilforce changed the base branch from main to v12.0.0 July 8, 2026 13:56
@sbosio
sbosio force-pushed the feat/exclude-backups-from-long-running-queries branch from be852e9 to 355e9c8 Compare August 12, 2026 13:34
@sbosio
sbosio deployed to AcceptanceTests August 12, 2026 13:34 — with GitHub Actions Active
@sbosio
sbosio deployed to AcceptanceTests August 12, 2026 13:34 — with GitHub Actions Active
@sbosio
sbosio deployed to AcceptanceTests August 12, 2026 13:34 — with GitHub Actions Active
@sbosio
sbosio deployed to AcceptanceTests August 12, 2026 13:34 — with GitHub Actions Active

@sbosio sbosio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sbosio
sbosio merged commit 0b72bfc into v12.0.0 Aug 12, 2026
20 checks passed
@sbosio
sbosio deleted the feat/exclude-backups-from-long-running-queries branch August 12, 2026 14:18
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.

4 participants