-
Notifications
You must be signed in to change notification settings - Fork 152
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
Using SKIP LOCKED on Postgres 9.5 #279
Comments
If someone do it, it would be interesting to see benchmarks, because from experience this is the bottleneck with a lot of load...when we had say over 100 workers hitting What do you think @senny? |
@jipiboily I don't have a qualified opinion on it. I'm also no longer using QC as heavily as I used to. |
I'd happily send a PR (I actually patched the SQL locally already and all tests pass) but don't have a benchmark harness set up. Just thinking about what SKIP LOCKED does I'd bet money that it is a huge improvement, since it doesn't have to churn through subtransactions when NOWAIT raises and doesn't have to do a Count(*) either. After skimming the change I'm willing to raise that bet further ;) |
This is a promising idea. Would it be possible to preserve backward compatibility with postgres 9.3/9.4? |
Just FYI, I am not using QC anymore at all...so I guess if you send a PR it might take some time for it to be reviewed & merged... @smathieu are you still using QC? |
I've forked queue-shootout here and updated it to queue_classic master here: https://github.com/MSch/queue-shootout The results of comparing queue_classic master vs queue_classic with SKIP LOCKED vs que on my MacBook are here: https://gist.github.com/MSch/b4588b20d7116b4e78667cc474a19e8b master:
With SKIP LOCKED from MSch@8394489:
|
Query plan with SKIP LOCKED: http://explain.depesz.com/s/uJ9g
I tried that and added a VACUUM FULL between runs, then reran the benchmarks: https://gist.github.com/MSch/7464aa8454cc3bfb5e64c7f10d9e4756 master:
SKIP LOCKED:
SKIP LOCKED + HOT updates:
|
@jipiboily we are still using it, but personally I don't think I'm up for serious maintenance work or a Big Upgrade (I think we'll probably migrate to another solution instead at some point). Maybe @ukd1 feels differently though? |
@shosti totally understand that. "Back in the days", I have been an advocate to remove QC from RF's stack (for various reasons). @MSch looks like pretty cool upgrades! I guess we now need to figure out what to do in terms of maintenance with QC...as apparently most maintainers are either inactive or are not using it anymore. @smathieu are you using QC at your job? |
@shosti late reply; I think we should do this...though we need to move to 9.5 first... |
Hi, @jipiboily just out of curiosity what are you using to accomplish the same QC does? Thanks :) |
@shalomabitan I'm using exclusively Sidekiq via ActiveJob nowadays for my Ruby projects. I am considering using SQS too at some point. |
@jipiboily you don't have beef with transactions? |
@ukd1 not a problem for my use case. Not saying it would not be better, but nothing really bad can happen in my case. |
Heads up @MSch, the link in the header is dead and redirects to ad sites. |
@jipiboily @MSch @senny @smathieu - it's been ...years... but @JasonHerr's code was merged in #311! Closing! |
It looks like
lock_head
is a perfect candidate for the new SKIP LOCKED feature in Postgres 9.5If I'm not missing something then using SKIP LOCKED
lock_head
can be simplified to this:The text was updated successfully, but these errors were encountered: