explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nnHR

Settings
# exclusive inclusive rows x rows loops node
1. 9,191.714 9,191.714 ↓ 849.0 849 1

CTE Scan on src_side (cost=6,123,356.36..6,123,356.38 rows=1 width=544) (actual time=8,943.154..9,191.714 rows=849 loops=1)

2.          

CTE all_src_intervals

3. 471.042 6,096.542 ↓ 1.5 349,657 1

Recursive Union (cost=1,000.42..4,619,407.62 rows=235,000 width=56) (actual time=1.252..6,096.542 rows=349,657 loops=1)

4. 0.000 491.426 ↑ 1.2 191,939 1

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

  • Workers Planned: 5
  • Workers Launched: 5
5. 36.708 751.810 ↑ 1.5 31,990 6 / 6

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

6. 74.064 74.064 ↑ 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.018..74.064 rows=58,276 loops=6)

7. 641.038 641.038 ↓ 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.011..0.011 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,032.724 5,134.074 ↓ 574.0 78,060 11

Merge Join (cost=423,972.96..444,123.48 rows=136 width=56) (actual time=372.545..466.734 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,422.509 1,470.095 ↑ 162.9 14,339 11

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

  • Sort Key: intv.eind_geldigheid, intv._id
  • Sort Method: quicksort Memory: 25kB
10. 47.586 47.586 ↑ 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..4.326 rows=31,787 loops=11)

11. 2,371.771 2,631.255 ↓ 1.3 469,419 11

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

  • Sort Key: src.begin_geldigheid, src._id
  • Sort Method: quicksort Memory: 39,605kB
12. 259.484 259.484 ↑ 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.017..259.484 rows=349,657 loops=1)

  • Filter: (begin_geldigheid IS NOT NULL)
13.          

CTE all_dst_intervals

14. 242.804 1,144.301 ↓ 1.4 361,928 1

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

15. 220.813 464.617 ↑ 1.3 184,537 1

Hash Anti Join (cost=33,012.20..67,575.72 rows=244,872 width=30) (actual time=182.846..464.617 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. 61.577 61.577 ↑ 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.014..61.577 rows=361,928 loops=1)

17. 59.971 182.227 ↑ 2.0 177,396 1

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

  • Buckets: 524,288 Batches: 1 Memory Usage: 13,791kB
18. 122.256 122.256 ↑ 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.004..122.256 rows=361,928 loops=1)

19. 146.540 436.880 ↓ 37.6 35,533 5

Hash Join (cost=33,012.20..137,118.28 rows=946 width=56) (actual time=50.220..87.376 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.855 41.855 ↑ 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.371 rows=72,386 loops=5)

21. 107.093 248.485 ↑ 1.0 361,928 1

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

  • Buckets: 524,288 Batches: 1 Memory Usage: 24,711kB
22. 141.392 141.392 ↑ 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..141.392 rows=361,928 loops=1)

  • Filter: (begin_geldigheid IS NOT NULL)
23.          

CTE src_entities

24. 1.003 8.946 ↑ 1.0 10,000 1

Limit (cost=0.00..2,800.07 rows=10,000 width=816) (actual time=0.018..8.946 rows=10,000 loops=1)

25. 7.943 7.943 ↑ 35.0 10,000 1

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

26.          

CTE src_volgnummer_begin_geldigheid

27. 6.940 6,381.076 ↑ 2.4 10,000 1

HashAggregate (cost=7,369.06..7,604.06 rows=23,500 width=44) (actual time=6,378.678..6,381.076 rows=10,000 loops=1)

  • Group Key: all_src_intervals._id, all_src_intervals.volgnummer
28. 114.991 6,374.136 ↑ 5.9 10,000 1

Hash Join (cost=275.00..6,928.44 rows=58,750 width=44) (actual time=11.620..6,374.136 rows=10,000 loops=1)

  • Hash Cond: (((all_src_intervals._id)::text = (src_entities._id)::text) AND (all_src_intervals.volgnummer = src_entities.volgnummer))
29. 6,248.794 6,248.794 ↓ 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.254..6,248.794 rows=349,657 loops=1)

30. 1.956 10.351 ↓ 10.0 10,000 1

Hash (cost=260.00..260.00 rows=1,000 width=36) (actual time=10.351..10.351 rows=10,000 loops=1)

  • Buckets: 16,384 (originally 1024) Batches: 1 (originally 1) Memory Usage: 675kB
31. 5.350 8.395 ↓ 10.0 10,000 1

HashAggregate (cost=250.00..260.00 rows=1,000 width=36) (actual time=6.597..8.395 rows=10,000 loops=1)

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

CTE Scan on src_entities (cost=0.00..200.00 rows=10,000 width=36) (actual time=0.002..3.045 rows=10,000 loops=1)

33.          

CTE dst_entities

34. 61.773 61.773 ↑ 1.0 361,928 1

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

35.          

CTE dst_volgnummer_begin_geldigheid

36. 283.218 2,419.379 ↓ 14.2 361,928 1

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

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

Hash Join (cost=9,953.03..17,153.80 rows=63,583 width=44) (actual time=816.216..2,136.161 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,270.841 1,270.841 ↓ 1.4 361,928 1

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

39. 95.275 633.258 ↓ 10.0 361,928 1

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

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

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

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

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

42.          

CTE max_src_event

43. 0.002 0.024 ↑ 1.0 1 1

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

44.          

Initplan (for Result)

45. 0.002 0.022 ↑ 1.0 1 1

Limit (cost=0.42..0.47 rows=1 width=4) (actual time=0.021..0.022 rows=1 loops=1)

46. 0.020 0.020 ↑ 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.020..0.020 rows=1 loops=1)

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

CTE max_dst_event

48. 0.001 0.016 ↑ 1.0 1 1

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

49.          

Initplan (for Result)

50. 0.001 0.015 ↑ 1.0 1 1

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

51. 0.014 0.014 ↑ 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.014..0.014 rows=1 loops=1)

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

CTE src_side

53. 1.766 9,191.070 ↓ 849.0 849 1

Nested Loop (cost=3,502.92..4,230.28 rows=1 width=492) (actual time=8,943.151..9,191.070 rows=849 loops=1)

54. 0.597 9,189.304 ↓ 849.0 849 1

Nested Loop (cost=3,502.92..4,230.15 rows=1 width=384) (actual time=8,943.122..9,189.304 rows=849 loops=1)

55. 0.429 9,188.707 ↓ 849.0 849 1

Nested Loop Left Join (cost=3,502.92..4,230.12 rows=1 width=380) (actual time=8,943.095..9,188.707 rows=849 loops=1)

  • Join Filter: (((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. 0.195 9,187.429 ↓ 849.0 849 1

Nested Loop (cost=3,252.77..3,954.94 rows=1 width=244) (actual time=8,943.077..9,187.429 rows=849 loops=1)

  • Join Filter: (((json_arr_elm_1.item ->> 'bronwaarde'::text)) = (json_arr_elm.item ->> 'bronwaarde'::text))
57. 54.852 9,185.536 ↓ 849.0 849 1

Hash Right Join (cost=3,252.77..3,952.19 rows=1 width=276) (actual time=8,943.055..9,185.536 rows=849 loops=1)

  • Hash Cond: (((dst_bg._id)::text = (dst_1._id)::text) AND (dst_bg.volgnummer = dst_1.volgnummer))
58. 2,512.784 2,512.784 ↓ 14.2 361,928 1

CTE Scan on dst_volgnummer_begin_geldigheid dst_bg (cost=0.00..508.66 rows=25,433 width=44) (actual time=2,324.998..2,512.784 rows=361,928 loops=1)

59. 0.310 6,617.900 ↓ 849.0 849 1

Hash (cost=3,252.75..3,252.75 rows=1 width=268) (actual time=6,617.899..6,617.900 rows=849 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 177kB
60. 1.787 6,617.590 ↓ 849.0 849 1

Hash Right Join (cost=2,606.49..3,252.75 rows=1 width=268) (actual time=6,610.245..6,617.590 rows=849 loops=1)

  • Hash Cond: (((src_bg._id)::text = (src_2._id)::text) AND (src_bg.volgnummer = src_2.volgnummer))
61. 6,384.250 6,384.250 ↑ 2.4 10,000 1

CTE Scan on src_volgnummer_begin_geldigheid src_bg (cost=0.00..470.00 rows=23,500 width=44) (actual time=6,378.681..6,384.250 rows=10,000 loops=1)

62. 0.351 231.553 ↓ 849.0 849 1

Hash (cost=2,606.48..2,606.48 rows=1 width=260) (actual time=231.553..231.553 rows=849 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 169kB
63. 6.529 231.202 ↓ 849.0 849 1

Nested Loop (cost=2,159.56..2,606.48 rows=1 width=260) (actual time=206.973..231.202 rows=849 loops=1)

64. 8.425 224.673 ↓ 1,056.6 10,566 1

Merge Join (cost=2,159.14..2,588.19 rows=10 width=238) (actual time=206.456..224.673 rows=10,566 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)
65. 6.912 169.404 ↓ 1.4 10,566 1

WindowAgg (cost=1,294.75..1,508.15 rows=7,760 width=118) (actual time=160.959..169.404 rows=10,566 loops=1)

66. 39.250 162.492 ↓ 1.4 10,566 1

Sort (cost=1,294.75..1,314.15 rows=7,760 width=110) (actual time=160.938..162.492 rows=10,566 loops=1)

  • Sort Key: src_entities_2._id, src_entities_2.volgnummer, ((json_arr_elm_1.item ->> 'bronwaarde'::text))
  • Sort Method: quicksort Memory: 1,263kB
67. 8.836 123.242 ↓ 1.4 10,566 1

HashAggregate (cost=696.38..793.38 rows=7,760 width=110) (actual time=120.245..123.242 rows=10,566 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
68. 5.194 114.406 ↓ 1.4 10,566 1

Nested Loop (cost=0.42..579.98 rows=7,760 width=110) (actual time=0.061..114.406 rows=10,566 loops=1)

69. 10.209 98.646 ↓ 135.5 10,566 1

Nested Loop Left Join (cost=0.42..385.08 rows=78 width=110) (actual time=0.051..98.646 rows=10,566 loops=1)

70. 28.437 28.437 ↓ 200.0 10,000 1

CTE Scan on src_entities src_entities_2 (cost=0.00..200.00 rows=50 width=140) (actual time=0.025..28.437 rows=10,000 loops=1)

  • Filter: (_date_deleted IS NULL)
71. 60.000 60.000 ↓ 0.0 0 10,000

Index Scan using bag_ozk_2c5e9e3edb055efb9ce5e2a9588c46f6 on bag_onderzoeken dst_2 (cost=0.42..3.68 rows=2 width=43) (actual time=0.006..0.006 rows=0 loops=10,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
72. 10.566 10.566 ↑ 100.0 1 10,566

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=10,566)

  • Filter: ((item ->> 'bronwaarde'::text) IS NOT NULL)
73. 43.091 46.844 ↓ 1.1 10,566 1

Sort (cost=864.39..889.39 rows=10,000 width=188) (actual time=45.486..46.844 rows=10,566 loops=1)

  • Sort Key: src_2._id, src_2.volgnummer
  • Sort Method: quicksort Memory: 1,791kB
74. 3.753 3.753 ↑ 1.0 10,000 1

CTE Scan on src_entities src_2 (cost=0.00..200.00 rows=10,000 width=188) (actual time=0.003..3.753 rows=10,000 loops=1)

75. 0.000 0.000 ↓ 0.0 0 10,566

Index Scan using bag_onderzoeken__id_volgnummer_key on bag_onderzoeken dst_1 (cost=0.42..1.83 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=10,566)

  • 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.698 1.698 ↑ 100.0 1 849

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

  • Filter: ((item ->> 'bronwaarde'::text) IS NOT NULL)
77. 0.000 0.849 ↓ 0.0 0 849

Nested Loop (cost=250.15..275.17 rows=1 width=204) (actual time=0.001..0.001 rows=0 loops=849)

  • 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. 0.849 0.849 ↓ 0.0 0 849

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.001..0.001 rows=0 loops=849)

  • 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=250.00..260.00 rows=1,000 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..200.00 rows=10,000 width=36) (never executed)

81. 0.000 0.000 ↑ 1.0 1 849

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

82. 0.000 0.000 ↑ 1.0 1 849

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

Planning time : 14.328 ms
Execution time : 9,262.101 ms