Skip to content
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

pgmq.metrics() can slow down when queue size is large #170

Open
ChuckHend opened this issue Dec 6, 2023 · 1 comment
Open

pgmq.metrics() can slow down when queue size is large #170

ChuckHend opened this issue Dec 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ChuckHend
Copy link
Contributor

ChuckHend commented Dec 6, 2023

metrics function calcs the min and max of each message here. There is no index on enqueued_at, and we dont need an index there for normal read() and send(), since we sort by msg_id. However, getting the max and min of enqueued_at can slow down when there are millions of messages in the queue. A temporary fix could be to create an index on enqueued_at there will regularly be large number of messages in queue.

@ChuckHend ChuckHend added the bug Something isn't working label May 14, 2024
@haydenflinner
Copy link

Perfect use-case for a BRIN Index, would have as close to trivial overhead as I think is easy to do in pg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants