explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ka1s

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Sort (cost=10,354.57..10,354.57 rows=1 width=617) (actual rows= loops=)

  • Sort Key: (CASE updated.priority WHEN 'HIGH'::command_priority_enum THEN 0 WHEN 'MEDIUM'::command_priority_enum THEN 1 WHEN 'DEFAULT'::command_priority_enum THEN 2 WHEN 'LOW'::command_priority_enum THEN 3 ELSE NULL::integer END), work_unit.order_id
2.          

CTE updated

3. 0.000 0.000 ↓ 0.0

Update on command (cost=10,329.87..10,337.89 rows=1 width=1,134) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10,329.87..10,337.89 rows=1 width=1,134) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

HashAggregate (cost=10,329.58..10,329.59 rows=1 width=56) (actual rows= loops=)

  • Group Key: "ANY_subquery".id
6. 0.000 0.000 ↓ 0.0

Subquery Scan on ANY_subquery (cost=10,329.56..10,329.57 rows=1 width=56) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Limit (cost=10,329.56..10,329.56 rows=1 width=28) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Sort (cost=10,329.56..10,341.76 rows=4,879 width=28) (actual rows= loops=)

  • Sort Key: (CASE command_1.priority WHEN 'HIGH'::command_priority_enum THEN 0 WHEN 'MEDIUM'::command_priority_enum THEN 1 WHEN 'DEFAULT'::command_priority_enum THEN 2 WHEN 'LOW'::command_priority_enum THEN 3 ELSE NULL::integer END), work_unit_1.order_id
9. 0.000 0.000 ↓ 0.0

Hash Join (cost=8,166.51..10,305.17 rows=4,879 width=28) (actual rows= loops=)

  • Hash Cond: (work_unit_1.id = command_1.work_unit_id)
10. 0.000 0.000 ↓ 0.0

Seq Scan on work_unit work_unit_1 (cost=0.00..1,866.78 rows=46,478 width=24) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash (cost=8,105.48..8,105.48 rows=4,883 width=36) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Seq Scan on command command_1 (cost=0.00..8,105.48 rows=4,883 width=36) (actual rows= loops=)

  • Filter: (command_state = 'QUEUED'::command_state_enum)
13. 0.000 0.000 ↓ 0.0

Index Scan using command_pkey on command (cost=0.29..8.31 rows=1 width=1,090) (actual rows= loops=)

  • Index Cond: (id = "ANY_subquery".id)
14.          

CTE update_wu

15. 0.000 0.000 ↓ 0.0

Update on work_unit work_unit_2 (cost=0.29..8.33 rows=1 width=241) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.29..8.33 rows=1 width=241) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

CTE Scan on updated updated_1 (cost=0.00..0.02 rows=1 width=56) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Index Scan using work_unit_pkey on work_unit work_unit_2 (cost=0.29..8.31 rows=1 width=189) (actual rows= loops=)

  • Index Cond: (id = updated_1.work_unit_id)
19. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.29..8.34 rows=1 width=617) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

CTE Scan on updated (cost=0.00..0.02 rows=1 width=605) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Index Scan using work_unit_pkey on work_unit (cost=0.29..8.31 rows=1 width=24) (actual rows= loops=)

  • Index Cond: (id = updated.work_unit_id)