explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c7RJ

Settings
# exclusive inclusive rows x rows loops node
1. 21,227.746 21,227.746 ↓ 165.0 165 1

CTE Scan on src_side (cost=6,117,873.47..6,117,873.49 rows=1 width=544) (actual time=8,330.627..21,227.746 rows=165 loops=1)

2.          

CTE all_src_intervals

3. 422.991 5,809.845 ↓ 1.5 349,657 1

Recursive Union (cost=1,000.42..4,619,407.62 rows=235,000 width=56) (actual time=1.204..5,809.845 rows=349,657 loops=1)

4. 0.000 538.021 ↑ 1.2 191,939 1

Gather (cost=1,000.42..173,472.85 rows=233,640 width=41) (actual time=1.201..538.021 rows=191,939 loops=1)

  • Workers Planned: 5
  • Workers Launched: 5
5. 40.122 691.830 ↑ 1.5 31,990 6 / 6

Nested Loop Anti Join (cost=0.42..149,108.85 rows=46,728 width=41) (actual time=0.416..691.830 rows=31,990 loops=6)

6. 68.946 68.946 ↑ 1.2 58,276 6 / 6

Parallel Seq Scan on bag_panden s (cost=0.00..95,109.31 rows=69,931 width=37) (actual time=0.015..68.946 rows=58,276 loops=6)

7. 582.762 582.762 ↓ 0.0 0 349,657 / 6

Index Scan using bag_panden__id_volgnummer_key on bag_panden t (cost=0.42..0.76 rows=1 width=29) (actual time=0.010..0.010 rows=0 loops=349,657)

  • Index Cond: (((s._id)::text = (_id)::text) AND (volgnummer < s.volgnummer))
  • Filter: (eind_geldigheid = s.begin_geldigheid)
  • Rows Removed by Filter: 0
8. 1,043.482 4,848.833 ↓ 574.0 78,060 11

Merge Join (cost=423,972.96..444,123.48 rows=136 width=56) (actual time=345.485..440.803 rows=78,060 loops=11)

  • Merge Cond: ((intv.eind_geldigheid = src.begin_geldigheid) AND ((intv._id)::text = (src._id)::text))
  • Join Filter: (src.volgnummer > intv.volgnummer)
  • Rows Removed by Join Filter: 66,621
9. 1,375.418 1,416.184 ↑ 162.9 14,339 11

Sort (cost=293,870.71..299,711.71 rows=2,336,400 width=56) (actual time=126.590..128.744 rows=14,339 loops=11)

  • Sort Key: intv.eind_geldigheid, intv._id
  • Sort Method: quicksort Memory: 25kB
10. 40.766 40.766 ↑ 73.5 31,787 11

WorkTable Scan on all_src_intervals intv (cost=0.00..46,728.00 rows=2,336,400 width=56) (actual time=0.002..3.706 rows=31,787 loops=11)

11. 2,151.876 2,389.167 ↓ 1.3 469,419 11

Sort (cost=130,102.25..130,976.40 rows=349,657 width=37) (actual time=164.713..217.197 rows=469,419 loops=11)

  • Sort Key: src.begin_geldigheid, src._id
  • Sort Method: quicksort Memory: 39,605kB
12. 237.291 237.291 ↑ 1.0 349,657 1

Seq Scan on bag_panden src (cost=0.00..97,906.57 rows=349,657 width=37) (actual time=0.014..237.291 rows=349,657 loops=1)

  • Filter: (begin_geldigheid IS NOT NULL)
13.          

CTE all_dst_intervals

14. 218.515 1,144.198 ↓ 1.4 361,928 1

Recursive Union (cost=33,012.20..1,443,845.11 rows=254,332 width=56) (actual time=267.946..1,144.198 rows=361,928 loops=1)

15. 204.335 528.198 ↑ 1.3 184,537 1

Hash Anti Join (cost=33,012.20..67,575.72 rows=244,872 width=30) (actual time=267.942..528.198 rows=184,537 loops=1)

  • Hash Cond: (((s_1._id)::text = (t_1._id)::text) AND (s_1.begin_geldigheid = t_1.eind_geldigheid))
  • Join Filter: (t_1.volgnummer < s_1.volgnummer)
  • Rows Removed by Join Filter: 11,814
16. 56.595 56.595 ↑ 1.0 361,928 1

Seq Scan on bag_onderzoeken s_1 (cost=0.00..27,583.28 rows=361,928 width=26) (actual time=0.020..56.595 rows=361,928 loops=1)

17. 72.150 267.268 ↑ 2.0 177,396 1

Hash (cost=27,583.28..27,583.28 rows=361,928 width=18) (actual time=267.267..267.268 rows=177,396 loops=1)

  • Buckets: 524,288 Batches: 1 Memory Usage: 13,791kB
18. 195.118 195.118 ↑ 1.0 361,928 1

Seq Scan on bag_onderzoeken t_1 (cost=0.00..27,583.28 rows=361,928 width=18) (actual time=0.012..195.118 rows=361,928 loops=1)

19. 129.132 397.485 ↓ 37.6 35,533 5

Hash Join (cost=33,012.20..137,118.28 rows=946 width=56) (actual time=45.825..79.497 rows=35,533 loops=5)

  • Hash Cond: ((intv_1.eind_geldigheid = dst.begin_geldigheid) AND ((intv_1._id)::text = (dst._id)::text))
  • Join Filter: (dst.volgnummer > intv_1.volgnummer)
  • Rows Removed by Join Filter: 2,370
20. 41.565 41.565 ↑ 33.8 72,386 5

WorkTable Scan on all_dst_intervals intv_1 (cost=0.00..48,974.40 rows=2,448,720 width=56) (actual time=0.001..8.313 rows=72,386 loops=5)

21. 96.528 226.788 ↑ 1.0 361,928 1

Hash (cost=27,583.28..27,583.28 rows=361,928 width=26) (actual time=226.788..226.788 rows=361,928 loops=1)

  • Buckets: 524,288 Batches: 1 Memory Usage: 24,711kB
22. 130.260 130.260 ↑ 1.0 361,928 1

Seq Scan on bag_onderzoeken dst (cost=0.00..27,583.28 rows=361,928 width=26) (actual time=0.010..130.260 rows=361,928 loops=1)

  • Filter: (begin_geldigheid IS NOT NULL)
23.          

CTE src_entities

24. 0.101 0.929 ↑ 1.0 1,000 1

Limit (cost=0.00..280.01 rows=1,000 width=816) (actual time=0.013..0.929 rows=1,000 loops=1)

25. 0.828 0.828 ↑ 349.7 1,000 1

Seq Scan on bag_panden src_1 (cost=0.00..97,906.57 rows=349,657 width=816) (actual time=0.012..0.828 rows=1,000 loops=1)

26.          

CTE src_volgnummer_begin_geldigheid

27. 1.348 5,991.840 ↑ 23.5 1,000 1

HashAggregate (cost=7,124.06..7,359.06 rows=23,500 width=44) (actual time=5,991.167..5,991.840 rows=1,000 loops=1)

  • Group Key: all_src_intervals._id, all_src_intervals.volgnummer
28. 66.240 5,990.492 ↑ 58.8 1,000 1

Hash Join (cost=30.00..6,683.44 rows=58,750 width=44) (actual time=2.195..5,990.492 rows=1,000 loops=1)

  • Hash Cond: (((all_src_intervals._id)::text = (src_entities._id)::text) AND (all_src_intervals.volgnummer = src_entities.volgnummer))
29. 5,923.275 5,923.275 ↓ 1.5 349,657 1

CTE Scan on all_src_intervals (cost=0.00..4,700.00 rows=235,000 width=44) (actual time=1.206..5,923.275 rows=349,657 loops=1)

30. 0.158 0.977 ↓ 5.0 1,000 1

Hash (cost=27.00..27.00 rows=200 width=36) (actual time=0.977..0.977 rows=1,000 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 63kB
31. 0.459 0.819 ↓ 5.0 1,000 1

HashAggregate (cost=25.00..27.00 rows=200 width=36) (actual time=0.671..0.819 rows=1,000 loops=1)

  • Group Key: (src_entities._id)::text, src_entities.volgnummer
32. 0.360 0.360 ↑ 1.0 1,000 1

CTE Scan on src_entities (cost=0.00..20.00 rows=1,000 width=36) (actual time=0.003..0.360 rows=1,000 loops=1)

33.          

CTE dst_entities

34. 55.157 55.157 ↑ 1.0 361,928 1

Seq Scan on bag_onderzoeken (cost=0.00..27,583.28 rows=361,928 width=218) (actual time=0.005..55.157 rows=361,928 loops=1)

35.          

CTE dst_volgnummer_begin_geldigheid

36. 268.365 2,277.339 ↓ 14.2 361,928 1

HashAggregate (cost=17,630.67..17,885.00 rows=25,433 width=44) (actual time=2,182.452..2,277.339 rows=361,928 loops=1)

  • Group Key: all_dst_intervals._id, all_dst_intervals.volgnummer
37. 203.676 2,008.974 ↓ 5.7 361,928 1

Hash Join (cost=9,953.03..17,153.80 rows=63,583 width=44) (actual time=816.211..2,008.974 rows=361,928 loops=1)

  • Hash Cond: (((all_dst_intervals._id)::text = (dst_entities._id)::text) AND (all_dst_intervals.volgnummer = dst_entities.volgnummer))
38. 1,257.129 1,257.129 ↓ 1.4 361,928 1

CTE Scan on all_dst_intervals (cost=0.00..5,086.64 rows=254,332 width=44) (actual time=267.948..1,257.129 rows=361,928 loops=1)

39. 78.857 548.169 ↓ 10.0 361,928 1

Hash (cost=9,410.13..9,410.13 rows=36,193 width=36) (actual time=548.169..548.169 rows=361,928 loops=1)

  • Buckets: 524,288 (originally 65536) Batches: 1 (originally 1) Memory Usage: 19,641kB
40. 239.689 469.312 ↓ 10.0 361,928 1

HashAggregate (cost=9,048.20..9,410.13 rows=36,193 width=36) (actual time=378.359..469.312 rows=361,928 loops=1)

  • Group Key: (dst_entities._id)::text, dst_entities.volgnummer
41. 229.623 229.623 ↑ 1.0 361,928 1

CTE Scan on dst_entities (cost=0.00..7,238.56 rows=361,928 width=36) (actual time=0.008..229.623 rows=361,928 loops=1)

42.          

CTE max_src_event

43. 0.003 0.031 ↑ 1.0 1 1

Result (cost=0.47..0.48 rows=1 width=4) (actual time=0.031..0.031 rows=1 loops=1)

44.          

Initplan (for Result)

45. 0.002 0.028 ↑ 1.0 1 1

Limit (cost=0.42..0.47 rows=1 width=4) (actual time=0.027..0.028 rows=1 loops=1)

46. 0.026 0.026 ↑ 349,657.0 1 1

Index Only Scan Backward using bag_pnd_613273a0ec2090693894cea102aa8c06 on bag_panden (cost=0.42..15,917.83 rows=349,657 width=4) (actual time=0.026..0.026 rows=1 loops=1)

  • Index Cond: (_last_event IS NOT NULL)
  • Heap Fetches: 1
47.          

CTE max_dst_event

48. 0.002 0.015 ↑ 1.0 1 1

Result (cost=0.45..0.46 rows=1 width=4) (actual time=0.015..0.015 rows=1 loops=1)

49.          

Initplan (for Result)

50. 0.000 0.013 ↑ 1.0 1 1

Limit (cost=0.42..0.45 rows=1 width=4) (actual time=0.013..0.013 rows=1 loops=1)

51. 0.013 0.013 ↑ 361,928.0 1 1

Index Only Scan Backward using bag_ozk_613273a0ec2090693894cea102aa8c06 on bag_onderzoeken bag_onderzoeken_1 (cost=0.42..9,548.36 rows=361,928 width=4) (actual time=0.013..0.013 rows=1 loops=1)

  • Index Cond: (_last_event IS NOT NULL)
  • Heap Fetches: 0
52.          

CTE src_side

53. 1.806 21,227.066 ↓ 165.0 165 1

Nested Loop (cost=161.57..1,512.45 rows=1 width=492) (actual time=8,330.623..21,227.066 rows=165 loops=1)

54. 0.325 21,225.095 ↓ 165.0 165 1

Nested Loop (cost=161.57..1,512.33 rows=1 width=384) (actual time=8,330.594..21,225.095 rows=165 loops=1)

55. 0.794 21,224.605 ↓ 165.0 165 1

Nested Loop Left Join (cost=161.57..1,512.30 rows=1 width=380) (actual time=8,330.561..21,224.605 rows=165 loops=1)

  • Join Filter: (((src_2._application)::text = 'Neuron'::text) AND ((rel_bag_pnd_bag_ozk_heeft_onderzoeken.src_id)::text = (src_2._id)::text) AND (rel_bag_pnd_bag_ozk_heeft_onderzoeken.src_volgnummer = src_2.volgnummer) AND ((json_arr_elm.item ->> 'bronwaarde'::text) = (rel_bag_pnd_bag_ozk_heeft_onderzoeken.bronwaarde)::text))
  • Filter: ((rel_bag_pnd_bag_ozk_heeft_onderzoeken._date_deleted IS NULL) OR (src_2._id IS NOT NULL))
56. 1.624 21,221.831 ↓ 165.0 165 1

Nested Loop (cost=136.42..1,482.11 rows=1 width=244) (actual time=8,330.539..21,221.831 rows=165 loops=1)

57. 1.489 6,013.207 ↓ 1,110.0 1,110 1

Hash Right Join (cost=131.10..777.36 rows=1 width=246) (actual time=6,010.442..6,013.207 rows=1,110 loops=1)

  • Hash Cond: (((src_bg._id)::text = (src_2._id)::text) AND (src_bg.volgnummer = src_2.volgnummer))
58. 5,992.457 5,992.457 ↑ 23.5 1,000 1

CTE Scan on src_volgnummer_begin_geldigheid src_bg (cost=0.00..470.00 rows=23,500 width=44) (actual time=5,991.170..5,992.457 rows=1,000 loops=1)

59. 0.360 19.261 ↓ 1,110.0 1,110 1

Hash (cost=131.09..131.09 rows=1 width=238) (actual time=19.261..19.261 rows=1,110 loops=1)

  • Buckets: 2,048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 193kB
60. 0.980 18.901 ↓ 1,110.0 1,110 1

Merge Join (cost=109.79..131.09 rows=1 width=238) (actual time=17.042..18.901 rows=1,110 loops=1)

  • Merge Cond: (((src_entities_2._id)::text = (src_2._id)::text) AND (src_entities_2.volgnummer = src_2.volgnummer))
  • Join Filter: ((src_2._source)::text = (src_entities_2._source)::text)
61. 0.715 14.549 ↓ 2.2 1,110 1

WindowAgg (cost=87.23..100.98 rows=500 width=118) (actual time=13.730..14.549 rows=1,110 loops=1)

62. 2.988 13.834 ↓ 2.2 1,110 1

Sort (cost=87.23..88.48 rows=500 width=110) (actual time=13.721..13.834 rows=1,110 loops=1)

  • Sort Key: src_entities_2._id, src_entities_2.volgnummer, ((json_arr_elm_1.item ->> 'bronwaarde'::text))
  • Sort Method: quicksort Memory: 146kB
63. 0.697 10.846 ↓ 2.2 1,110 1

HashAggregate (cost=58.57..64.82 rows=500 width=110) (actual time=10.615..10.846 rows=1,110 loops=1)

  • Group Key: src_entities_2._id, dst_2._id, (json_arr_elm_1.item ->> 'bronwaarde'::text), src_entities_2._source, src_entities_2.volgnummer
64. 0.388 10.149 ↓ 2.2 1,110 1

Nested Loop (cost=0.42..51.07 rows=500 width=110) (actual time=0.049..10.149 rows=1,110 loops=1)

65. 0.377 8.651 ↓ 222.0 1,110 1

Nested Loop Left Join (cost=0.42..38.56 rows=5 width=110) (actual time=0.040..8.651 rows=1,110 loops=1)

  • Join Filter: ((src_entities_2._application)::text = 'Neuron'::text)
66. 2.274 2.274 ↓ 200.0 1,000 1

CTE Scan on src_entities src_entities_2 (cost=0.00..20.00 rows=5 width=172) (actual time=0.017..2.274 rows=1,000 loops=1)

  • Filter: (_date_deleted IS NULL)
67. 6.000 6.000 ↓ 0.0 0 1,000

Index Scan using bag_ozk_2c5e9e3edb055efb9ce5e2a9588c46f6 on bag_onderzoeken dst_2 (cost=0.42..3.69 rows=2 width=43) (actual time=0.006..0.006 rows=0 loops=1,000)

  • Index Cond: ((object_identificatie)::text = (src_entities_2.identificatie)::text)
  • Filter: ((_date_deleted IS NULL) AND ((begin_geldigheid < src_entities_2.eind_geldigheid) OR (src_entities_2.eind_geldigheid IS NULL)) AND ((eind_geldigheid >= src_entities_2.eind_geldigheid) OR (eind_geldigheid IS NULL)))
  • Rows Removed by Filter: 0
68. 1.110 1.110 ↑ 100.0 1 1,110

Function Scan on jsonb_array_elements json_arr_elm_1 (cost=0.00..1.25 rows=100 width=32) (actual time=0.001..0.001 rows=1 loops=1,110)

  • Filter: ((item ->> 'bronwaarde'::text) IS NOT NULL)
69. 2.922 3.372 ↓ 222.0 1,110 1

Sort (cost=22.56..22.57 rows=5 width=188) (actual time=3.304..3.372 rows=1,110 loops=1)

  • Sort Key: src_2._id, src_2.volgnummer
  • Sort Method: quicksort Memory: 165kB
70. 0.450 0.450 ↓ 200.0 1,000 1

CTE Scan on src_entities src_2 (cost=0.00..22.50 rows=5 width=188) (actual time=0.003..0.450 rows=1,000 loops=1)

  • Filter: ((_application)::text = 'Neuron'::text)
71. 7,122.480 15,207.000 ↓ 0.0 0 1,110

Hash Right Join (cost=5.32..704.74 rows=1 width=72) (actual time=7.701..13.700 rows=0 loops=1,110)

  • Hash Cond: (((dst_bg._id)::text = (dst_1._id)::text) AND (dst_bg.volgnummer = dst_1.volgnummer))
72. 8,076.750 8,076.750 ↓ 14.2 361,928 165

CTE Scan on dst_volgnummer_begin_geldigheid dst_bg (cost=0.00..508.66 rows=25,433 width=44) (actual time=13.228..48.950 rows=361,928 loops=165)

73. 0.000 7.770 ↓ 0.0 0 1,110

Hash (cost=5.31..5.31 rows=1 width=64) (actual time=0.007..0.007 rows=0 loops=1,110)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
74. 1.515 7.770 ↓ 0.0 0 1,110

Nested Loop (cost=0.42..5.31 rows=1 width=64) (actual time=0.007..0.007 rows=0 loops=1,110)

  • Join Filter: (((json_arr_elm_1.item ->> 'bronwaarde'::text)) = (json_arr_elm.item ->> 'bronwaarde'::text))
75. 4.440 4.440 ↓ 0.0 0 1,110

Index Scan using bag_onderzoeken__id_volgnummer_key on bag_onderzoeken dst_1 (cost=0.42..2.55 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1,110)

  • Index Cond: (((_id)::text = (dst_2._id)::text) AND (_id IS NOT NULL) AND (volgnummer = (max(dst_2.volgnummer))))
  • Filter: (_date_deleted IS NULL)
76. 1.815 1.815 ↑ 100.0 1 165

Function Scan on jsonb_array_elements json_arr_elm (cost=0.00..1.25 rows=100 width=32) (actual time=0.011..0.011 rows=1 loops=165)

  • Filter: ((item ->> 'bronwaarde'::text) IS NOT NULL)
77. 0.495 1.980 ↓ 0.0 0 165

Nested Loop (cost=25.14..30.17 rows=1 width=204) (actual time=0.012..0.012 rows=0 loops=165)

  • Join Filter: (((rel_bag_pnd_bag_ozk_heeft_onderzoeken.src_id)::text = (src_entities_1._id)::text) AND (rel_bag_pnd_bag_ozk_heeft_onderzoeken.src_volgnummer = src_entities_1.volgnummer))
78. 1.485 1.485 ↓ 0.0 0 165

Index Scan using rel_bag_pnd_bag_ozk_fb10656a_c5625cb292cd152f07c13709330d1712 on rel_bag_pnd_bag_ozk_heeft_onderzoeken (cost=0.14..0.17 rows=1 width=204) (actual time=0.009..0.009 rows=0 loops=165)

  • Index Cond: (((dst_id)::text = (dst_1._id)::text) AND (dst_volgnummer = dst_1.volgnummer))
79. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=25.00..27.00 rows=200 width=36) (never executed)

  • Group Key: (src_entities_1._id)::text, src_entities_1.volgnummer
80. 0.000 0.000 ↓ 0.0 0

CTE Scan on src_entities src_entities_1 (cost=0.00..20.00 rows=1,000 width=36) (never executed)

81. 0.165 0.165 ↑ 1.0 1 165

CTE Scan on max_src_event (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=165)

82. 0.165 0.165 ↑ 1.0 1 165

CTE Scan on max_dst_event (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.001 rows=1 loops=165)

Planning time : 13.134 ms
Execution time : 21,289.034 ms