Synthetic fixtures computed locally. No model or production service is contacted.
Experiment workspace
Decision trace
The question this experiment answers
Several workers take jobs from one PostgreSQL table. Which worker gets which job, who waits, and what happens to a job when its worker dies or runs slow? Choose how jobs are claimed: plain FOR UPDATE inside a transaction, FOR UPDATE SKIP LOCKED inside a transaction, or a lease claim that commits at once and records an owner, an attempt number and an expiry. Then replay a timeline of worker events and read the result.
Change one assumption at a time
Start from a preset and change a single control. Switch plainwait from plain to skip and the 900 ms wait disappears. In leaseblind, change the finish check to guarded and the old worker's finish is rejected. In poison, raise max attempts and the job is retried instead of moved to dead. Timeline lines have the form 1200 B claim: a time in milliseconds, a worker name and claim, done or crash. A worker must finish or crash before it claims again.
Expected outcomes
plainwait: B waits 900 ms behind A and then gets job 2, as measured on PostgreSQL 18.4. skip: A, B and C get jobs 1, 2 and 3 at once and D gets nothing. txcrash: when A dies its transaction rolls back and B gets job 1 immediately. leaseblind and leaseguarded: after the 2,000 ms lease expires, w2 re-claims job 1 as attempt 2; a blind finish by w1 still updates the row, a guarded finish is rejected, and in both the work of job 1 ran twice. leasecrash: job 1 waits for its lease to expire before B can take it. poison: after two attempts the job is dead-lettered. order: jobs finish as 2 3 4 5 1 6. These match the companion Python model.
Read the table and the trace
The table lists every worker event with the job it touched and what the database did: locked in an open transaction, waited, got a row after waiting, claimed with an attempt and lease, updated or matched 0 rows. The trace explains each step in words and ends with a summary: jobs done, queued, running without a live owner, dead and processed twice, and the total time workers spent blocked.
Reset and export
Reset inputs restores the selected preset and recomputes. Export JSON downloads the inputs, every event row, the metrics, the trace and the stated limits, which can serve as a fixture for testing a real queue worker.
Limits
A rule model of one jobs table at read committed isolation; every statement is instantaneous and events at the same millisecond run in the order listed. Presets plainwait to leaseguarded reproduce what the companion probe measured on PostgreSQL 18.4; other timelines are predictions. Vacuum, index scans, connection limits and lock timeouts are not modelled, and a lease only expires when a later claim finds it expired.