# SKIP LOCKED vs. Redis: When Should You Use a Database Queue?

DevFeed: [SKIP LOCKED vs. Redis: When Should You Use a Database Queue?](<https://devfeed.tech/articles/skip-locked-vs-redis-when-should-you-use-a-database-queue-104356.md>)

Original publisher: [Read original article](<https://hackernoon.com/skip-locked-vs-redis-when-should-you-use-a-database-queue?source=rss>)

Author: Vasyl Vdovychenko

Published: 2026-10-28T07:52:57Z

Content type: comparison

Language: en

Sources: [HackerNoon](<https://devfeed.tech/sources/hackernoon.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Database](<https://devfeed.tech/topics/database.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [Transactions](<https://devfeed.tech/topics/transactions.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [at-least-once-delivery](<https://devfeed.tech/tags/at-least-once-delivery.md>), [backend](<https://devfeed.tech/tags/backend.md>), [background](<https://devfeed.tech/tags/background.md>), [background-job-processing](<https://devfeed.tech/tags/background-job-processing.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [database](<https://devfeed.tech/tags/database.md>), [database-row-locking](<https://devfeed.tech/tags/database-row-locking.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [for-update](<https://devfeed.tech/tags/for-update.md>), [idempotency](<https://devfeed.tech/tags/idempotency.md>), [jobs](<https://devfeed.tech/tags/jobs.md>), [postgres-job-queue](<https://devfeed.tech/tags/postgres-job-queue.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [queue](<https://devfeed.tech/tags/queue.md>), [queues](<https://devfeed.tech/tags/queues.md>), [redis](<https://devfeed.tech/tags/redis.md>), [skip](<https://devfeed.tech/tags/skip.md>), [tokens](<https://devfeed.tech/tags/tokens.md>)

## AI overview

`SKIP LOCKED` lets concurrent workers atomically claim different queued rows without waiting, but it only protects the claim: a crash after commit can leave a job stuck as `running`. Recovery needs leases, while heartbeats help slow workers retain a lease; timeouts can still create overlapping owners. Increasing fencing tokens let the database reject stale workers' final writes, and idempotency keys can make repeated external calls, such as payments or emails, harmless. The article describes tradeoffs of a database queue: PostgreSQL update bloat and vacuum work, reliance on the primary, no strict processing order, worker connection use, and limits at very high throughput. For a single-worker side project, the author instead uses a PostgreSQL advisory lock plus an alert for long-running jobs, noting that a dropped database connection loses the lock. The approach fits when its recovery and operational costs are understood; it is not a silver bullet.

## Source excerpt

Is SKIP LOCKED enough for reliable background jobs? Explore leases, heartbeats, fencing tokens, and idempotency in PostgreSQL queues.