explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8dj

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 9,168.865 ↑ 1.0 1 1

Limit (cost=1,122.70..1,122.71 rows=1 width=10) (actual time=9,168.864..9,168.865 rows=1 loops=1)

2. 0.011 9,168.864 ↑ 1.0 1 1

Sort (cost=1,122.70..1,122.71 rows=1 width=10) (actual time=9,168.864..9,168.864 rows=1 loops=1)

  • Sort Key: cq.priority DESC, cq.id
  • Sort Method: quicksort Memory: 25kB
3. 0.015 9,168.853 ↑ 1.0 1 1

Nested Loop Anti Join (cost=1,088.97..1,122.69 rows=1 width=10) (actual time=37.668..9,168.853 rows=1 loops=1)

4. 3,718.607 9,168.769 ↑ 1.0 1 1

Nested Loop (cost=1,088.41..1,096.93 rows=1 width=25) (actual time=37.584..9,168.769 rows=1 loops=1)

  • Join Filter: (cq.id = (min(cq2.id)))
  • Rows Removed by Join Filter: 75506687
5. 20.934 20.934 ↓ 10,924.0 10,924 1

Index Scan using command_queue_status_idx on command_queue cq (cost=0.56..4.59 rows=1 width=25) (actual time=0.055..20.934 rows=10,924 loops=1)

  • Index Cond: ((status)::text = 'PENDING'::text)
6. 5,393.272 5,429.228 ↓ 34.6 6,912 10,924

HashAggregate (cost=1,087.84..1,089.84 rows=200 width=8) (actual time=0.003..0.497 rows=6,912 loops=10,924)

  • Group Key: min(cq2.id)
7. 6.960 35.956 ↓ 1.7 6,912 1

HashAggregate (cost=997.50..1,037.65 rows=4,015 width=23) (actual time=34.844..35.956 rows=6,912 loops=1)

  • Group Key: cq2.target_id
8. 28.996 28.996 ↓ 4.4 17,835 1

Index Scan using command_queue_status_idx on command_queue cq2 (cost=0.56..977.39 rows=4,023 width=23) (actual time=0.026..28.996 rows=17,835 loops=1)

  • Index Cond: ((status)::text = ANY ('{PENDING,ERROR}'::text[]))
9. 0.069 0.069 ↓ 0.0 0 1

Index Only Scan using command_queue_idx on command_queue cq3 (cost=0.56..13.17 rows=1 width=15) (actual time=0.069..0.069 rows=0 loops=1)

  • Index Cond: ((status = ANY ('{PROCESSING,ERROR}'::text[])) AND (to_recalculate = false) AND (target_id = (cq.target_id)::text))
  • Filter: (NOT to_recalculate)
  • Heap Fetches: 3
Planning time : 0.612 ms
Execution time : 9,168.939 ms