explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ErW

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 6,999.817 ↓ 5.5 11 1

Limit (cost=18,395.09..18,395.11 rows=2 width=194) (actual time=6,999.812..6,999.817 rows=11 loops=1)

2. 0.004 6,999.814 ↓ 5.5 11 1

Subquery Scan on lead_report (cost=18,395.09..18,395.11 rows=2 width=194) (actual time=6,999.811..6,999.814 rows=11 loops=1)

3. 0.000 6,999.810 ↓ 5.5 11 1

Sort (cost=18,395.09..18,395.09 rows=2 width=198) (actual time=6,999.808..6,999.810 rows=11 loops=1)

  • Sort Key: action.client_entity_seq_id DESC
  • Sort Method: quicksort Memory: 27kB
4.          

Initplan (for Sort)

5. 0.216 2.788 ↓ 101.6 508 1

HashAggregate (cost=3,491.21..3,491.26 rows=5 width=4) (actual time=2.735..2.788 rows=508 loops=1)

  • Group Key: edl.entity_id
6.          

CTE user_data_filter

7. 0.404 0.404 ↓ 1.1 957 1

Index Scan using idx_user_data_access_user_id on user_data_access (cost=0.43..919.47 rows=855 width=48) (actual time=0.019..0.404 rows=957 loops=1)

  • Index Cond: (user_id = 10254)
  • Filter: (NOT deleted)
8. 0.042 2.572 ↓ 115.2 576 1

Append (cost=0.42..2,571.73 rows=5 width=4) (actual time=0.502..2.572 rows=576 loops=1)

9. 0.000 2.461 ↓ 144.0 576 1

Nested Loop (cost=0.42..1,087.41 rows=4 width=4) (actual time=0.501..2.461 rows=576 loops=1)

10. 0.638 0.638 ↓ 2.2 957 1

CTE Scan on user_data_filter da (cost=0.00..17.10 rows=428 width=8) (actual time=0.021..0.638 rows=957 loops=1)

  • Filter: self_access
11. 1.914 1.914 ↑ 1.0 1 957

Index Scan using idx_entity_data_link_entity_type_id_ancestor_type_id_ancestor_i on entity_data_link edl (cost=0.42..2.49 rows=1 width=12) (actual time=0.001..0.002 rows=1 loops=957)

  • Index Cond: ((entity_type_id = 18) AND (ancestor_type_id = da.entity_type_id) AND (ancestor_id = da.entity_id))
  • Filter: (NOT deleted)
  • Rows Removed by Filter: 0
12. 0.000 0.069 ↓ 0.0 0 1

Nested Loop (cost=0.85..1,484.25 rows=1 width=4) (actual time=0.069..0.069 rows=0 loops=1)

  • Join Filter: (edc.ancestor_type_id = ANY (da_1.access_type_ids))
13. 0.000 0.069 ↓ 0.0 0 1

Nested Loop (cost=0.42..1,468.00 rows=31 width=40) (actual time=0.069..0.069 rows=0 loops=1)

14. 0.069 0.069 ↓ 0.0 0 1

CTE Scan on user_data_filter da_1 (cost=0.00..17.10 rows=428 width=40) (actual time=0.069..0.069 rows=0 loops=1)

  • Filter: (NOT self_access)
  • Rows Removed by Filter: 957
15. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_entity_data_link_ancestor_type_id_ancestor_id on entity_data_link edl_1 (cost=0.42..3.38 rows=1 width=16) (never executed)

  • Index Cond: ((ancestor_type_id = da_1.entity_type_id) AND (ancestor_id = da_1.entity_id))
  • Filter: (parent AND (NOT deleted))
16. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_entity_data_link_entity_type_id_ancestor_type_id_ancestor_i on entity_data_link edc (cost=0.42..0.50 rows=1 width=12) (never executed)

  • Index Cond: ((entity_type_id = 18) AND (ancestor_type_id = edl_1.entity_type_id) AND (ancestor_id = edl_1.entity_id))
  • Filter: (NOT deleted)
17. 0.082 6,999.780 ↓ 5.5 11 1

Nested Loop Left Join (cost=7.00..14,903.81 rows=2 width=198) (actual time=1,322.329..6,999.780 rows=11 loops=1)

18. 0.023 6,999.665 ↓ 5.5 11 1

Nested Loop Left Join (cost=6.71..14,898.71 rows=2 width=145) (actual time=1,322.303..6,999.665 rows=11 loops=1)

19. 0.027 6,999.620 ↓ 5.5 11 1

Nested Loop Left Join (cost=6.56..14,893.95 rows=2 width=143) (actual time=1,322.295..6,999.620 rows=11 loops=1)

20. 0.024 6,999.549 ↓ 5.5 11 1

Nested Loop Left Join (cost=6.28..14,888.95 rows=2 width=128) (actual time=1,322.282..6,999.549 rows=11 loops=1)

21. 0.020 6,999.481 ↓ 5.5 11 1

Nested Loop Left Join (cost=6.00..14,883.96 rows=2 width=111) (actual time=1,322.270..6,999.481 rows=11 loops=1)

22. 1.587 6,999.417 ↓ 5.5 11 1

Nested Loop Semi Join (cost=5.86..14,880.27 rows=2 width=99) (actual time=1,322.255..6,999.417 rows=11 loops=1)

23. 5.210 5.210 ↓ 254.0 508 1

Index Scan using action_item_mgmt_id_idx on action_item_mgmt action (cost=0.28..22.12 rows=2 width=99) (actual time=2.901..5.210 rows=508 loops=1)

  • Index Cond: (id = ANY ($7))
  • Filter: ((NOT deleted) AND (client_id = 1002))
24. 1,560.202 6,992.620 ↓ 0.0 0 508

Hash Join (cost=5.58..14,666.00 rows=159 width=4) (actual time=13.765..13.765 rows=0 loops=508)

  • Hash Cond: (wftlt.lead_time_id = wfelt.lead_time_id)
25. 5,244.966 5,244.966 ↑ 1.0 92,917 246

Seq Scan on work_flow_task_lead_time wftlt (cost=0.00..13,932.29 rows=96,872 width=4) (actual time=0.011..21.321 rows=92,917 loops=246)

  • Filter: (lead_time_type = 3)
  • Rows Removed by Filter: 51683
26. 18.796 187.452 ↓ 73.2 293 508

Hash (cost=5.53..5.53 rows=4 width=8) (actual time=0.369..0.369 rows=293 loops=508)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
27. 168.656 168.656 ↓ 73.2 293 508

Index Scan using idx_work_flow_entity_lead_time_entity on work_flow_entity_lead_time wfelt (cost=0.56..5.53 rows=4 width=8) (actual time=0.007..0.332 rows=293 loops=508)

  • Index Cond: ((entity_type_id = 18) AND (entity_id = action.id))
28. 0.044 0.044 ↑ 1.0 1 11

Index Scan using pk_time_zone on time_zone tz (cost=0.14..1.81 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=11)

  • Index Cond: (id = action.time_zone_id)
29. 0.044 0.044 ↑ 1.0 1 11

Index Scan using pk_relation on relation re (cost=0.28..2.50 rows=1 width=21) (actual time=0.004..0.004 rows=1 loops=11)

  • Index Cond: (action.relation_id = id)
30. 0.044 0.044 ↑ 1.0 1 11

Index Scan using pk_work_flow_status on work_flow_status ets (cost=0.28..2.50 rows=1 width=23) (actual time=0.004..0.004 rows=1 loops=11)

  • Index Cond: (action.status_id = id)
31. 0.022 0.022 ↑ 1.0 1 11

Index Scan using pk_tier on tier (cost=0.14..2.36 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=11)

  • Index Cond: (action.tier_id = id)
32. 0.033 0.033 ↓ 0.0 0 11

Index Scan using pk_governance_body_child on governance_body_child gbc (cost=0.29..2.51 rows=1 width=24) (actual time=0.003..0.003 rows=0 loops=11)

  • Index Cond: (action.governance_body_child_id = id)
Planning time : 3.305 ms
Execution time : 7,000.093 ms