Problem Description

Implement a safe job-queue pop: pick one NEW job, lock it so others can't pick it, mark it IN_PROGRESS, and return the picked job_id. Use FOR UPDATE SKIP LOCKED if available.

Input Format

SQL script

Output Format

Statements

Sample Test Case

Input:
Jobs(job_id, status, created_at)
Output:
One job reserved

Constraints

Assume PostgreSQL and SKIP LOCKED support

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next