explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rdrJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 53,523.072 ↓ 1,177.0 2,354 1

Sort (cost=973.88..973.88 rows=2 width=44) (actual time=53,522.972..53,523.072 rows=2,354 loops=1)

  • Sort Key: action.status_id
  • Sort Method: quicksort Memory: 282kB
2.          

Initplan (for Sort)

3. 0.403 3.897 ↓ 1,177.0 2,354 1

Unique (cost=430.35..430.36 rows=2 width=4) (actual time=3.346..3.897 rows=2,354 loops=1)

4.          

CTE user_data_filter

5. 0.159 0.159 ↑ 4.1 21 1

Index Scan using idx_user_data_access_user_id on user_data_access (cost=0.42..52.02 rows=86 width=23) (actual time=0.056..0.159 rows=21 loops=1)

  • Index Cond: (user_id = 2,159,767)
  • Filter: (NOT deleted)
6. 0.911 3.494 ↓ 1,177.0 2,354 1

Sort (cost=378.33..378.33 rows=2 width=4) (actual time=3.345..3.494 rows=2,354 loops=1)

  • Sort Key: edl.entity_id
  • Sort Method: quicksort Memory: 207kB
7. 0.171 2.583 ↓ 1,177.0 2,354 1

Append (cost=0.43..378.32 rows=2 width=4) (actual time=0.108..2.583 rows=2,354 loops=1)

8. 0.218 2.407 ↓ 2,354.0 2,354 1

Nested Loop (cost=0.43..116.10 rows=1 width=4) (actual time=0.107..2.407 rows=2,354 loops=1)

9. 0.173 0.173 ↑ 2.0 21 1

CTE Scan on user_data_filter da (cost=0.00..1.72 rows=43 width=8) (actual time=0.059..0.173 rows=21 loops=1)

  • Filter: self_access
10. 2.016 2.016 ↓ 112.0 112 21

Index Scan using idx_entity_data_link_entity_type_id_ancestor_type_id_ancestor_i on entity_data_link edl (cost=0.43..2.65 rows=1 width=12) (actual time=0.005..0.096 rows=112 loops=21)

  • 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: 1
11. 0.000 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.85..262.19 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=1)

  • Join Filter: (edc.ancestor_type_id = ANY (da_1.access_type_ids))
12. 0.001 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.43..255.97 rows=12 width=40) (actual time=0.005..0.005 rows=0 loops=1)

13. 0.004 0.004 ↓ 0.0 0 1

CTE Scan on user_data_filter da_1 (cost=0.00..1.72 rows=43 width=40) (actual time=0.004..0.004 rows=0 loops=1)

  • Filter: (NOT self_access)
  • Rows Removed by Filter: 21
14. 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.43..5.90 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))
15. 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.43..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)
16. 1,920.848 53,521.426 ↓ 1,177.0 2,354 1

Group (cost=1.71..543.51 rows=2 width=44) (actual time=4.316..53,521.426 rows=2,354 loops=1)

  • Group Key: action.id
17. 8,304.562 51,595.723 ↓ 307,666.1 34,458,607 1

Nested Loop Left Join (cost=1.71..477.58 rows=112 width=20) (actual time=4.294..51,595.723 rows=34,458,607 loops=1)

18. 3,365.745 8,832.554 ↓ 307,666.1 34,458,607 1

Nested Loop Left Join (cost=1.28..179.66 rows=112 width=20) (actual time=4.278..8,832.554 rows=34,458,607 loops=1)

19. 82.490 254.309 ↓ 20,850.0 41,700 1

Nested Loop Left Join (cost=0.85..68.54 rows=2 width=20) (actual time=4.260..254.309 rows=41,700 loops=1)

  • Join Filter: (action.type_id = lcat.type_id)
  • Rows Removed by Join Filter: 1,542,683
20. 21.471 88.419 ↓ 20,850.0 41,700 1

Nested Loop Left Join (cost=0.85..36.42 rows=2 width=24) (actual time=4.205..88.419 rows=41,700 loops=1)

  • Join Filter: (res.id = rcl.responsibility_id)
  • Rows Removed by Join Filter: 83,370
21. 27.932 66.948 ↓ 20,850.0 41,700 1

Nested Loop Left Join (cost=0.85..32.11 rows=2 width=28) (actual time=4.194..66.948 rows=41,700 loops=1)

  • Join Filter: (res.id = action.responsibility_id)
  • Rows Removed by Join Filter: 125,035
22. 7.584 39.016 ↓ 20,850.0 41,700 1

Nested Loop Left Join (cost=0.72..29.63 rows=2 width=28) (actual time=4.181..39.016 rows=41,700 loops=1)

23. 12.600 12.600 ↓ 1,177.0 2,354 1

Index Scan using action_item_mgmt_id_idx on action_item_mgmt action (cost=0.29..24.31 rows=2 width=60) (actual time=4.171..12.600 rows=2,354 loops=1)

  • Index Cond: (id = ANY ($20))
  • Filter: ((NOT deleted) AND (client_id = 1,024))
24. 18.832 18.832 ↓ 18.0 18 2,354

Index Scan using idx_link_entity_function_6 on link_entity_function lef (cost=0.43..2.65 rows=1 width=8) (actual time=0.004..0.008 rows=18 loops=2,354)

  • Index Cond: ((action.id = entity_id) AND (entity_type_id = 18))
25. 0.000 0.000 ↑ 1.0 3 41,700

Materialize (cost=0.13..2.39 rows=3 width=4) (actual time=0.000..0.000 rows=3 loops=41,700)

26. 0.006 0.006 ↑ 1.0 3 1

Index Only Scan using pk_responsibility on responsibility res (cost=0.13..2.38 rows=3 width=4) (actual time=0.005..0.006 rows=3 loops=1)

  • Heap Fetches: 0
27. 0.000 0.000 ↑ 1.0 2 41,700

Materialize (cost=0.00..4.26 rows=2 width=4) (actual time=0.000..0.000 rows=2 loops=41,700)

28. 0.008 0.008 ↑ 1.0 2 1

Seq Scan on responsibility_client_link rcl (cost=0.00..4.25 rows=2 width=4) (actual time=0.006..0.008 rows=2 loops=1)

  • Filter: (client_id = 1,024)
  • Rows Removed by Filter: 18
29. 83.322 83.400 ↑ 1.0 37 41,700

Materialize (cost=0.00..31.10 rows=37 width=4) (actual time=0.000..0.002 rows=37 loops=41,700)

30. 0.078 0.078 ↑ 1.0 37 1

Seq Scan on link_client_action_type lcat (cost=0.00..30.91 rows=37 width=4) (actual time=0.052..0.078 rows=37 loops=1)

  • Filter: (client_id = 1,024)
  • Rows Removed by Filter: 516
31. 5,212.500 5,212.500 ↓ 14.8 826 41,700

Index Scan using idx_link_entity_service_6 on link_entity_service les (cost=0.44..55.00 rows=56 width=8) (actual time=0.007..0.125 rows=826 loops=41,700)

  • Index Cond: ((action.id = entity_id) AND (entity_type_id = 18))
32. 34,458.607 34,458.607 ↓ 0.0 0 34,458,607

Index Scan using idx_link_entity_delivery_country_6 on link_entity_delivery_country ledc2 (cost=0.43..2.65 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=34,458,607)

  • Index Cond: ((entity_id = action.id) AND (entity_type_id = 18))
33.          

SubPlan (for Group)

34. 4.478 4.478 ↑ 1.0 1 2,239

Index Scan using pk_relation on relation src (cost=0.29..2.51 rows=1 width=30) (actual time=0.002..0.002 rows=1 loops=2,239)

  • Index Cond: (id = action.entity_id)
35. 0.156 0.156 ↑ 1.0 1 52

Index Scan using pk_contract on contract src_1 (cost=0.29..2.51 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=52)

  • Index Cond: (id = action.entity_id)
36. 0.070 0.070 ↑ 1.0 1 14

Index Scan using pk_dno on dno src_2 (cost=0.29..2.50 rows=1 width=42) (actual time=0.004..0.005 rows=1 loops=14)

  • Index Cond: (id = action.entity_id)
37. 0.018 0.018 ↑ 1.0 1 1

Index Scan using pk_child_dno on child_dno src_3 (cost=0.42..2.64 rows=1 width=24) (actual time=0.017..0.018 rows=1 loops=1)

  • Index Cond: (id = action.entity_id)
38. 0.021 0.021 ↑ 1.0 1 3

Index Scan using pk_sla on sla src_4 (cost=0.29..2.51 rows=1 width=38) (actual time=0.007..0.007 rows=1 loops=3)

  • Index Cond: (id = action.entity_id)
39. 0.011 0.011 ↑ 1.0 1 1

Index Scan using pk_child_sla on child_sla src_5 (cost=0.42..2.64 rows=1 width=44) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (id = action.entity_id)
40. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contract_intpn on contract_intpn src_6 (cost=0.28..2.50 rows=1 width=20) (never executed)

  • Index Cond: (id = action.entity_id)
41. 0.039 0.039 ↑ 1.0 1 13

Index Scan using pk_issue_mgmt on issue_mgmt src_7 (cost=0.28..2.50 rows=1 width=18) (actual time=0.003..0.003 rows=1 loops=13)

  • Index Cond: (id = action.entity_id)
42. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_dispute_mgmt on dispute_mgmt src_8 (cost=0.28..2.50 rows=1 width=17) (never executed)

  • Index Cond: (id = action.entity_id)
43. 0.062 0.062 ↑ 1.0 1 31

Index Scan using action_item_mgmt_id_idx on action_item_mgmt src_9 (cost=0.29..2.50 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=31)

  • Index Cond: (id = action.entity_id)
44. 0.000 0.000 ↓ 0.0 0

Index Scan using change_request_pkey on change_request src_10 (cost=0.28..2.50 rows=1 width=20) (never executed)

  • Index Cond: (id = action.entity_id)
45. 0.000 0.000 ↓ 0.0 0

Index Scan using base_invoice_pkey on base_invoice src_11 (cost=0.28..2.50 rows=1 width=20) (never executed)

  • Index Cond: (id = action.entity_id)
46. 0.000 0.000 ↓ 0.0 0

Index Scan using work_order_request_pkey on work_order_request src_12 (cost=0.28..2.50 rows=1 width=12) (never executed)

  • Index Cond: (id = action.entity_id)
Planning time : 3.670 ms
Execution time : 53,523.625 ms