How to implement a work queue without SKIP LOCKED?

I’m converting from Postgres to Cockroach, my postgres db uses a work queue. and I’ve been using

`DELETE FROM queue

WHERE itemid = (
SELECT itemid
FROM queue
ORDER BY itemid
FOR UPDATE SKIP LOCKED
LIMIT 1
)
RETURNING *;`

However, SKIP LOCKED is not implemented, any recommendations for how to implement this?

Hey Eric,

CockroachDB utilizes MVCC in our storage layer. This means that newer versions of your data don’t overwrite your old data but instead are added with a later timestamp.

You can use AS OF SYSTEM TIME to have a full view of your data that is not “locked”. See this.

Let me know if this helps.