Created
January 5, 2018 00:03
-
-
Save mahmoud/68759bc25e2c1489ee3dfc3b9f4ec09d to your computer and use it in GitHub Desktop.
postgres queue get
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM {table_name} | |
WHERE id = ( | |
SELECT id | |
FROM {0} | |
WHERE deliver_after <= now() | |
AND q_name IN (SELECT unnest({q_names})) | |
ORDER BY priority DESC, created_at | |
FOR UPDATE SKIP LOCKED | |
LIMIT 1 | |
) | |
RETURNING *; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment