explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RsOd

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

Sort (cost=973.88..973.88 rows=2 width=44) (actual time=57,219.663..57,219.768 rows=2,354 loops=1)

  • Sort Key: action.status_id
  • Sort Method: quicksort Memory: 282kB
  • Buffers: shared hit=104,533,395 dirtied=1
2.          

Initplan (for Sort)

3. 0.294 2.589 ↓ 1,177.0 2,354 1

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

  • Buffers: shared hit=1,872
4.          

CTE user_data_filter

5. 0.036 0.036 ↑ 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.011..0.036 rows=21 loops=1)

  • Index Cond: (user_id = 2,159,767)
  • Filter: (NOT deleted)
  • Buffers: shared hit=22
6. 0.607 2.295 ↓ 1,177.0 2,354 1

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

  • Sort Key: edl.entity_id
  • Sort Method: quicksort Memory: 207kB
  • Buffers: shared hit=1,872
7. 0.193 1.688 ↓ 1,177.0 2,354 1

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

  • Buffers: shared hit=1,872
8. 0.207 1.491 ↓ 2,354.0 2,354 1

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

  • Buffers: shared hit=1,872
9. 0.045 0.045 ↑ 2.0 21 1

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

  • Filter: self_access
  • Buffers: shared hit=22
10. 1.239 1.239 ↓ 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.002..0.059 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
  • Buffers: shared hit=1,850
11. 0.000 0.004 ↓ 0.0 0 1

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

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

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

13. 0.003 0.003 ↓ 0.0 0 1

CTE Scan on user_data_filter da_1 (cost=0.00..1.72 rows=43 width=40) (actual time=0.003..0.003 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. 2,223.672 57,218.347 ↓ 1,177.0 2,354 1

Group (cost=1.71..543.51 rows=2 width=44) (actual time=2.911..57,218.347 rows=2,354 loops=1)

  • Group Key: action.id
  • Buffers: shared hit=104,533,392 dirtied=1
17. 10,887.471 54,989.750 ↓ 307,666.1 34,458,607 1

Nested Loop Left Join (cost=1.71..477.58 rows=112 width=20) (actual time=2.899..54,989.750 rows=34,458,607 loops=1)

  • Buffers: shared hit=104,526,326
18. 3,850.863 9,643.672 ↓ 307,666.1 34,458,607 1

Nested Loop Left Join (cost=1.28..179.66 rows=112 width=20) (actual time=2.890..9,643.672 rows=34,458,607 loops=1)

  • Buffers: shared hit=966,118
19. 104.559 288.409 ↓ 20,850.0 41,700 1

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

  • Join Filter: (action.type_id = lcat.type_id)
  • Rows Removed by Join Filter: 1,542,683
  • Buffers: shared hit=18,835
20. 23.475 100.450 ↓ 20,850.0 41,700 1

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

  • Join Filter: (res.id = rcl.responsibility_id)
  • Rows Removed by Join Filter: 83,370
  • Buffers: shared hit=18,829
21. 31.085 76.975 ↓ 20,850.0 41,700 1

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

  • Join Filter: (res.id = action.responsibility_id)
  • Rows Removed by Join Filter: 125,035
  • Buffers: shared hit=18,828
22. 7.546 45.890 ↓ 20,850.0 41,700 1

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

  • Buffers: shared hit=18,826
23. 14.804 14.804 ↓ 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=2.811..14.804 rows=2,354 loops=1)

  • Index Cond: (id = ANY ($20))
  • Filter: ((NOT deleted) AND (client_id = 1,024))
  • Buffers: shared hit=8,877
24. 23.540 23.540 ↓ 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.005..0.010 rows=18 loops=2,354)

  • Index Cond: ((action.id = entity_id) AND (entity_type_id = 18))
  • Buffers: shared hit=9,949
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)

  • Buffers: shared hit=2
26. 0.016 0.016 ↑ 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.015..0.016 rows=3 loops=1)

  • Heap Fetches: 0
  • Buffers: shared hit=2
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)

  • Buffers: shared hit=1
28. 0.006 0.006 ↑ 1.0 2 1

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

  • Filter: (client_id = 1,024)
  • Rows Removed by Filter: 18
  • Buffers: shared hit=1
29. 83.353 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)

  • Buffers: shared hit=6
30. 0.047 0.047 ↑ 1.0 37 1

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

  • Filter: (client_id = 1,024)
  • Rows Removed by Filter: 516
  • Buffers: shared hit=6
31. 5,504.400 5,504.400 ↓ 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.132 rows=826 loops=41,700)

  • Index Cond: ((action.id = entity_id) AND (entity_type_id = 18))
  • Buffers: shared hit=947,283
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))
  • Buffers: shared hit=103,560,208
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)
  • Buffers: shared hit=6,717
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)
  • Buffers: shared hit=156
36. 0.112 0.112 ↑ 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.008..0.008 rows=1 loops=14)

  • Index Cond: (id = action.entity_id)
  • Buffers: shared hit=42
37. 0.028 0.028 ↑ 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.028..0.028 rows=1 loops=1)

  • Index Cond: (id = action.entity_id)
  • Buffers: shared hit=4
38. 0.036 0.036 ↑ 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.012..0.012 rows=1 loops=3)

  • Index Cond: (id = action.entity_id)
  • Buffers: shared hit=9
39. 0.045 0.045 ↑ 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.034..0.045 rows=1 loops=1)

  • Index Cond: (id = action.entity_id)
  • Buffers: shared hit=6 dirtied=1
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)
  • Buffers: shared hit=39
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.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)
  • Buffers: shared hit=93
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 : 5.839 ms
Execution time : 57,220.153 ms