explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qENQ

Settings
# exclusive inclusive rows x rows loops node
1. 4,484.352 82,313.747 ↓ 13.0 2,354 1

Group (cost=14,012.49..20,049.29 rows=181 width=342) (actual time=71,418.841..82,313.747 rows=2,354 loops=1)

  • Group Key: action.id, r.id, c.id, gbc.id, gb.id, et.id, lcat.name
2.          

CTE ledc2

3. 6.979 6.979 ↓ 1.1 15,284 1

Index Scan using idx_link_entity_delivery_country_4 on link_entity_delivery_country (cost=0.43..11,108.21 rows=14,472 width=18) (actual time=0.049..6.979 rows=15,284 loops=1)

  • Index Cond: (entity_type_id = 18)
4.          

Initplan (for Group)

5. 0.257 3.710 ↓ 1,177.0 2,354 1

Unique (cost=1,052.54..1,052.55 rows=2 width=4) (actual time=3.353..3.710 rows=2,354 loops=1)

6.          

CTE user_data_filter

7. 0.167 0.167 ↑ 10.3 21 1

Index Scan using idx_user_data_access_user_id on user_data_access (cost=0.43..119.88 rows=216 width=23) (actual time=0.051..0.167 rows=21 loops=1)

  • Index Cond: (user_id = 2,159,767)
  • Filter: (NOT deleted)
8. 0.693 3.453 ↓ 1,177.0 2,354 1

Sort (cost=932.66..932.67 rows=2 width=4) (actual time=3.352..3.453 rows=2,354 loops=1)

  • Sort Key: edl.entity_id
  • Sort Method: quicksort Memory: 207kB
9. 0.157 2.760 ↓ 1,177.0 2,354 1

Append (cost=0.43..932.65 rows=2 width=4) (actual time=0.104..2.760 rows=2,354 loops=1)

10. 0.175 2.598 ↓ 2,354.0 2,354 1

Nested Loop (cost=0.43..291.60 rows=1 width=4) (actual time=0.103..2.598 rows=2,354 loops=1)

11. 0.176 0.176 ↑ 5.1 21 1

CTE Scan on user_data_filter da (cost=0.00..4.32 rows=108 width=8) (actual time=0.053..0.176 rows=21 loops=1)

  • Filter: self_access
12. 2.247 2.247 ↓ 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.004..0.107 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
13. 0.000 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.85..641.02 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))
14. 0.001 0.005 ↓ 0.0 0 1

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

15. 0.004 0.004 ↓ 0.0 0 1

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

  • Filter: (NOT self_access)
  • Rows Removed by Filter: 21
16. 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.82 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))
17. 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)
18. 41,868.802 77,821.027 ↓ 190,379.0 34,458,607 1

Sort (cost=1,851.73..1,852.18 rows=181 width=337) (actual time=71,416.917..77,821.027 rows=34,458,607 loops=1)

  • Sort Key: action.id, r.id, c.id, gbc.id, gb.id, et.id, lcat.name
  • Sort Method: external merge Disk: 12,803,176kB
19. 4,399.284 35,952.225 ↓ 190,379.0 34,458,607 1

Merge Left Join (cost=1,292.10..1,844.94 rows=181 width=337) (actual time=18.462..35,952.225 rows=34,458,607 loops=1)

  • Merge Cond: (action.id = ledc2.entity_id)
20. 10,928.123 31,538.687 ↓ 328,177.2 34,458,607 1

Nested Loop Left Join (cost=2.58..480.98 rows=105 width=337) (actual time=4.131..31,538.687 rows=34,458,607 loops=1)

21. 10,920.346 20,610.564 ↓ 328,177.2 34,458,607 1

Nested Loop Left Join (cost=2.30..448.51 rows=105 width=314) (actual time=4.124..20,610.564 rows=34,458,607 loops=1)

22. 4,232.690 9,690.218 ↓ 328,177.2 34,458,607 1

Nested Loop Left Join (cost=2.01..185.48 rows=105 width=284) (actual time=4.118..9,690.218 rows=34,458,607 loops=1)

23. 92.455 328.428 ↓ 20,850.0 41,700 1

Nested Loop Left Join (cost=1.57..83.30 rows=2 width=284) (actual time=4.080..328.428 rows=41,700 loops=1)

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

Nested Loop Left Join (cost=1.57..51.18 rows=2 width=274) (actual time=4.040..152.573 rows=41,700 loops=1)

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

Nested Loop Left Join (cost=1.57..46.87 rows=2 width=278) (actual time=4.023..127.527 rows=41,700 loops=1)

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

Nested Loop Left Join (cost=1.44..44.39 rows=2 width=278) (actual time=3.988..95.776 rows=41,700 loops=1)

27. 3.240 52.563 ↓ 1,177.0 2,354 1

Nested Loop Left Join (cost=1.01..39.07 rows=2 width=278) (actual time=3.959..52.563 rows=2,354 loops=1)

28. 4.622 39.907 ↓ 1,177.0 2,354 1

Nested Loop Left Join (cost=0.72..34.05 rows=2 width=248) (actual time=3.938..39.907 rows=2,354 loops=1)

29. 4.012 35.285 ↓ 1,177.0 2,354 1

Nested Loop Left Join (cost=0.43..29.04 rows=2 width=224) (actual time=3.936..35.285 rows=2,354 loops=1)

30. 24.211 24.211 ↓ 1,177.0 2,354 1

Index Scan using action_item_mgmt_id_idx on action_item_mgmt action (cost=0.29..24.30 rows=2 width=226) (actual time=3.929..24.211 rows=2,354 loops=1)

  • Index Cond: (id = ANY ($21))
  • Filter: ((NOT deleted) AND (client_id = 1,024))
31. 7.062 7.062 ↑ 1.0 1 2,354

Index Scan using pk_entity_type on entity_type et (cost=0.15..2.37 rows=1 width=22) (actual time=0.003..0.003 rows=1 loops=2,354)

  • Index Cond: (action.entity_type_id = id)
32. 0.000 0.000 ↓ 0.0 0 2,354

Index Scan using pk_contract on contract c (cost=0.29..2.51 rows=1 width=28) (actual time=0.000..0.000 rows=0 loops=2,354)

  • Index Cond: (action.contract_id = id)
33. 9.416 9.416 ↑ 1.0 1 2,354

Index Scan using pk_relation on relation r (cost=0.29..2.51 rows=1 width=34) (actual time=0.004..0.004 rows=1 loops=2,354)

  • Index Cond: (action.relation_id = id)
34. 32.956 32.956 ↓ 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.009..0.014 rows=18 loops=2,354)

  • Index Cond: ((action.id = entity_id) AND (entity_type_id = 18))
35. 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)

36. 0.030 0.030 ↑ 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.029..0.030 rows=3 loops=1)

  • Heap Fetches: 0
37. 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)

38. 0.013 0.013 ↑ 1.0 2 1

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

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

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

40. 0.061 0.061 ↑ 1.0 37 1

Seq Scan on link_client_action_type lcat (cost=0.00..30.91 rows=37 width=18) (actual time=0.037..0.061 rows=37 loops=1)

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

Index Scan using idx_link_entity_service_6 on link_entity_service les (cost=0.44..50.57 rows=52 width=8) (actual time=0.008..0.123 rows=826 loops=41,700)

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

Index Scan using pk_governance_body_child on governance_body_child gbc (cost=0.29..2.51 rows=1 width=34) (actual time=0.000..0.000 rows=0 loops=34,458,607)

  • Index Cond: (action.governance_body_child_id = id)
43. 0.000 0.000 ↓ 0.0 0 34,458,607

Index Scan using pk_governance_body on governance_body gb (cost=0.28..0.31 rows=1 width=27) (actual time=0.000..0.000 rows=0 loops=34,458,607)

  • Index Cond: (gbc.governance_body_id = id)
44. 3.950 14.254 ↓ 1.1 15,284 1

Sort (cost=1,289.53..1,325.71 rows=14,472 width=8) (actual time=13.553..14.254 rows=15,284 loops=1)

  • Sort Key: ledc2.entity_id
  • Sort Method: quicksort Memory: 1,101kB
45. 10.304 10.304 ↓ 1.1 15,284 1

CTE Scan on ledc2 (cost=0.00..289.44 rows=14,472 width=8) (actual time=0.050..10.304 rows=15,284 loops=1)

46.          

SubPlan (for Group)

47. 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.001..0.002 rows=1 loops=2,239)

  • Index Cond: (id = action.entity_id)
48. 0.052 0.052 ↑ 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.001..0.001 rows=1 loops=52)

  • Index Cond: (id = action.entity_id)
49. 0.056 0.056 ↑ 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.004 rows=1 loops=14)

  • Index Cond: (id = action.entity_id)
50. 0.016 0.016 ↑ 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.016..0.016 rows=1 loops=1)

  • Index Cond: (id = action.entity_id)
51. 0.009 0.009 ↑ 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.002..0.003 rows=1 loops=3)

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

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

  • Index Cond: (id = action.entity_id)
53. 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)
54. 0.013 0.013 ↑ 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.001..0.001 rows=1 loops=13)

  • Index Cond: (id = action.entity_id)
55. 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)
56. 0.031 0.031 ↑ 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.001..0.001 rows=1 loops=31)

  • Index Cond: (id = action.entity_id)
57. 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)
58. 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)
59. 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 : 10.497 ms
Execution time : 83,808.448 ms