Skip to content

only report wait times from clients currently waiting to match behavior of pgbouncer #655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

dbabiak
Copy link
Contributor

@dbabiak dbabiak commented Dec 4, 2023

The maxwait reported by pgcat differs in how it's measured from pgbouncer

maxwait in pgbouncer

How long the first (oldest) client in the queue has waited, in seconds

Pgcat instead tracked the longest wait time ever encountered by a client.

If a client in pgcat waited for a few seconds during a slow period, it would continue to report a high maxwait until it disconnects, even all of its subsequent queries have low wait times.

This changes pgcat behavior to match pgbouncer; max wait reported is now the max over all clients currently waiting.

https://discord.com/channels/1013868243036930099/1015389720622153819/1181065797892853771

@dbabiak dbabiak force-pushed the dbabiak/fix-maxwait-stats branch from 97a91f6 to b6cdc78 Compare December 4, 2023 22:27
@dbabiak dbabiak force-pushed the dbabiak/fix-maxwait-stats branch from b6cdc78 to 5bb99c2 Compare December 4, 2023 23:09
@levkk
Copy link
Contributor

levkk commented Dec 5, 2023

Looks like one of our integration tests caught this change and needs to be updated.

@dbabiak
Copy link
Contributor Author

dbabiak commented Dec 5, 2023

Just tweaked the integration tests, @levkk what do you think?

@levkk
Copy link
Contributor

levkk commented Dec 5, 2023

Amazing, thank you for this!

@levkk levkk merged commit 0e8064b into postgresml:main Dec 5, 2023
levkk added a commit that referenced this pull request Dec 5, 2023
levkk added a commit that referenced this pull request Dec 5, 2023
* Revert "Reset wait times when checked out successfully (#656)"

This reverts commit ec3920d.

* Revert "Not sure how this sneaked past CI"

This reverts commit 4c5498b.

* Revert "only report wait times from clients currently waiting to match behavior of pgbouncer (#655)"

This reverts commit 0e8064b.
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.

2 participants