explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VnWT

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 0.024 ↓ 0.0 0 1

Insert on tmp_queue_event (cost=96.47..140.99 rows=100 width=508) (actual time=0.024..0.024 rows=0 loops=1)

  • ,ctv_upd AS
  • INSERT INTO tmp_queue_event
  • (event_id, created_date, object_id, object_key, object_type_name, action_type_code)
  • SELECT tt.event_id
2.          

CTE ctv

3. 0.000 0.000 ↓ 0.0 0

Limit (cost=35.76..37.01 rows=100 width=30) (never executed)

4. 0.000 0.000 ↓ 0.0 0

LockRows (cost=35.76..41.93 rows=494 width=30) (never executed)

5. 0.000 0.000 ↓ 0.0 0

Sort (cost=35.76..36.99 rows=494 width=30) (never executed)

  • Sort Key: qe.created_date
6. 0.000 0.000 ↓ 0.0 0

Seq Scan on queue_event qe (cost=0.00..16.88 rows=494 width=30) (never executed)

  • Filter: ((NOT is_failed) AND (status_code = 0))
7.          

CTE ctv_upd

8. 0.001 0.003 ↓ 0.0 0 1

Update on queue_event qeu (cost=3.25..21.81 rows=100 width=164) (actual time=0.002..0.003 rows=0 loops=1)

9. 0.000 0.002 ↓ 0.0 0 1

Hash Join (cost=3.25..21.81 rows=100 width=164) (actual time=0.002..0.002 rows=0 loops=1)

  • Hash Cond: (qeu.event_id = t.event_id)
10. 0.002 0.002 ↓ 0.0 0 1

Seq Scan on queue_event qeu (cost=0.00..15.50 rows=550 width=122) (actual time=0.002..0.002 rows=0 loops=1)

11. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.00..2.00 rows=100 width=56) (never executed)

12. 0.000 0.000 ↓ 0.0 0

CTE Scan on ctv t (cost=0.00..2.00 rows=100 width=56) (never executed)

13. 0.004 0.023 ↓ 0.0 0 1

Hash Join (cost=37.65..82.18 rows=100 width=508) (actual time=0.023..0.023 rows=0 loops=1)

  • Hash Cond: (et.action_type_id = at1.action_type_id)
  • SELECT qe.event_id
  • FROM tvs_sync.queue_event AS qe
  • WHERE 1=1
  • AND qe.is_failed = FALSE
  • AND (p_event_type_id = 0 OR qe.event_type_id = p_event_type_id)
  • AND qe.status_code = 0
  • ORDER BY qe.created_date
  • LIMIT p_row_count
  • FOR UPDATE SKIP LOCKED
  • UPDATE tvs_sync.queue_event AS qeu
  • SET status_code = 1
  • FROM ctv AS t
  • WHERE qeu.event_id = t.event_id
  • RETURNING qeu.event_id
  • ,tt.created_date
  • ,tt.object_id
  • ,tt.object_key
  • ,ot.object_type_name
  • ,at1.action_type_code
  • FROM ctv_upd AS tt
  • JOIN tvs_sync.event_type AS et
  • ON et.event_type_id = tt.event_type_id
  • JOIN tvs_sync.object_type AS ot
  • ON ot.object_type_id = et.object_type_id
  • JOIN tvs_sync.action_type AS at1
  • ON at1.action_type_id = et.action_type_id
14. 0.000 0.010 ↓ 0.0 0 1

Hash Join (cost=20.45..64.71 rows=100 width=292) (actual time=0.010..0.010 rows=0 loops=1)

  • Hash Cond: (et.object_type_id = ot.object_type_id)
15. 0.005 0.010 ↓ 0.0 0 1

Hash Join (cost=3.25..47.25 rows=100 width=76) (actual time=0.010..0.010 rows=0 loops=1)

  • Hash Cond: (et.event_type_id = tt.event_type_id)
16. 0.002 0.002 ↑ 2,400.0 1 1

Seq Scan on event_type et (cost=0.00..34.00 rows=2,400 width=6) (actual time=0.002..0.002 rows=1 loops=1)

17. 0.000 0.003 ↓ 0.0 0 1

Hash (cost=2.00..2.00 rows=100 width=74) (actual time=0.003..0.003 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
18. 0.003 0.003 ↓ 0.0 0 1

CTE Scan on ctv_upd tt (cost=0.00..2.00 rows=100 width=74) (actual time=0.003..0.003 rows=0 loops=1)

19. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.20..13.20 rows=320 width=220) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Seq Scan on object_type ot (cost=0.00..13.20 rows=320 width=220) (never executed)

21. 0.009 0.009 ↑ 53.3 6 1

Hash (cost=13.20..13.20 rows=320 width=220) (actual time=0.009..0.009 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • -> Seq Scan on action_type at1 (cost=0.00..13.20 rows=320 width=220) (actual time=0.004..0.005 rows=6 loops=1);
  • ,qeu.created_date
  • ,qeu.object_id
  • ,qeu.object_key
  • ,qeu.event_type_id