explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4hPF

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 662.391 ↑ 1.0 1 1

Limit (cost=0.43..54,245.97 rows=1 width=63) (actual time=662.389..662.391 rows=1 loops=1)

2. 0.008 662.388 ↑ 358.0 1 1

LockRows (cost=0.43..19,419,904.32 rows=358 width=63) (actual time=662.388..662.388 rows=1 loops=1)

3. 662.380 662.380 ↑ 179.0 2 1

Index Scan using jobs_priority_run_at_id_idx on jobs (cost=0.43..19,419,900.74 rows=358 width=63) (actual time=662.378..662.380 rows=2 loops=1)

  • Index Cond: (run_at <= now())
  • Filter: ((task_identifier = ANY ('{card-state}'::text[])) AND (attempts < max_attempts) AND ((locked_at IS NULL) OR (locked_at < (now() - '04:00:00'::interval))) AND ((queue_name IS NULL) OR (SubPlan 1)))
  • Rows Removed by Filter: 344
4.          

SubPlan (for Index Scan)

5. 0.000 0.000 ↓ 0.0 0

LockRows (cost=0.55..8.59 rows=1 width=10) (never executed)

6. 0.000 0.000 ↓ 0.0 0

Index Scan using job_queues_pkey on job_queues (cost=0.55..8.58 rows=1 width=10) (never executed)

  • Index Cond: (queue_name = jobs.queue_name)
  • Filter: ((locked_at IS NULL) OR (locked_at < (now() - '04:00:00'::interval)))
Planning time : 57.665 ms
Execution time : 662.439 ms