Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
fix: DROP and CREATE concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Feb 2, 2024
1 parent ffd967d commit 1bb8de3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions migrations/20240202003133_better_dequeue_index.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
DROP INDEX idx_queue_scheduled_at;
DROP INDEX CONCURRENTLY idx_queue_scheduled_at;

/*
Partial index used for dequeuing from job_queue.
Dequeue only looks at available jobs so a partial index serves us well.
Moreover, dequeue sorts jobs by attempt and scheduled_at, which matches this index.
*/
CREATE INDEX idx_queue_dequeue_partial ON job_queue(queue, attempt, scheduled_at) WHERE status = 'available' :: job_status;
CREATE INDEX CONCURRENTLY idx_queue_dequeue_partial ON job_queue(queue, attempt, scheduled_at) WHERE status = 'available' :: job_status;

0 comments on commit 1bb8de3

Please sign in to comment.