explain.depesz.com

PostgreSQL's explain analyze made readable

Result: P4iw

Settings
# exclusive inclusive rows x rows loops node
1. 57,981.616 357,901.774 ↑ 19.0 1,060,958 1

Hash Left Join (cost=8,964,265.28..32,968,616.25 rows=20,157,323 width=1,252) (actual time=294,346.562..357,901.774 rows=1,060,958 loops=1)

  • Hash Cond: (wszystko.id_platnika = reg.id_kontrahenta)
2. 420.210 298,417.262 ↑ 19.0 1,060,958 1

Hash Left Join (cost=8,964,242.53..9,762,946.06 rows=20,157,323 width=1,220) (actual time=292,842.585..298,417.262 rows=1,060,958 loops=1)

  • Hash Cond: (x_dod.intvalue = x_stat.id)
3. 829.272 297,997.041 ↑ 19.0 1,060,958 1

Hash Left Join (cost=8,964,241.42..9,686,686.64 rows=20,157,323 width=1,208) (actual time=292,842.561..297,997.041 rows=1,060,958 loops=1)

  • Hash Cond: (wszystko.id_platnika = aa.id_kontrahenta)
4. 491.418 297,136.629 ↑ 19.0 1,060,958 1

Hash Left Join (cost=8,961,273.41..9,607,931.18 rows=20,157,323 width=1,208) (actual time=292,811.408..297,136.629 rows=1,060,958 loops=1)

  • Hash Cond: (wszystko.id = a.id_faktury)
5. 1,642.973 296,640.844 ↑ 19.0 1,060,958 1

Hash Left Join (cost=8,960,729.09..9,454,947.78 rows=20,157,323 width=1,146) (actual time=292,807.033..296,640.844 rows=1,060,958 loops=1)

  • Hash Cond: (wszystko.id_indeksu_podst = x.id_indeksu)
6. 436.084 294,941.274 ↓ 1.7 1,060,958 1

Subquery Scan on wszystko (cost=8,937,465.65..8,945,155.76 rows=615,209 width=698) (actual time=292,749.950..294,941.274 rows=1,060,958 loops=1)

7. 4,760.282 294,505.190 ↓ 1.7 1,060,958 1

Sort (cost=8,937,465.65..8,939,003.67 rows=615,209 width=451) (actual time=292,749.947..294,505.190 rows=1,060,958 loops=1)

  • Sort Key: a_1.data_wyst, a_1.id, b_1.id_towaru, zest.id_skladnika
  • Sort Method: external merge Disk: 349856kB
8.          

Initplan (for Sort)

9. 0.007 0.007 ↑ 1.0 1 1

Result (cost=0.00..0.02 rows=1 width=0) (actual time=0.007..0.007 rows=1 loops=1)

10. 1,763.942 289,744.901 ↓ 1.7 1,060,958 1

Hash Left Join (cost=8,576,755.33..8,788,191.08 rows=615,209 width=451) (actual time=286,561.425..289,744.901 rows=1,060,958 loops=1)

  • Hash Cond: (c.region = h.kod_regionu)
11. 326.639 287,980.951 ↓ 1.7 1,060,958 1

Hash Left Join (cost=8,576,754.19..8,734,937.96 rows=615,209 width=416) (actual time=286,550.595..287,980.951 rows=1,060,958 loops=1)

  • Hash Cond: (c.id_rodzaju2 = g.id_rodzaju)
12. 1,030.388 287,654.304 ↓ 1.7 1,060,958 1

Hash Right Join (cost=8,576,753.08..8,729,833.42 rows=615,209 width=379) (actual time=286,550.577..287,654.304 rows=1,060,958 loops=1)

  • Hash Cond: ((a_1_1.id_faktury = b_1.id_faktury) AND (b_1_1.id_towaru = b_1.id_towaru))
13. 30.242 1,607.182 ↑ 2.0 61,888 1

Hash Left Join (cost=463,359.02..469,648.62 rows=125,792 width=52) (actual time=1,533.713..1,607.182 rows=61,888 loops=1)

  • Hash Cond: (a_1_1.id_faktury = przyczyny_id.id_faktury)
14. 123.621 1,571.978 ↑ 2.0 61,888 1

HashAggregate (cost=462,946.04..464,832.92 rows=125,792 width=40) (actual time=1,528.735..1,571.978 rows=61,888 loops=1)

  • Filter: ((sum((b_1_1.ilosc + c_1.ilosc)) <> 0::double precision) OR (sum((b_1_1.wartosc_netto + c_1.wartosc_netto)) <> 0::double precision))
  • Rows Removed by Filter: 65436
15. 310.931 1,448.357 ↓ 1.2 150,157 1

Hash Right Join (cost=226,150.60..459,801.23 rows=125,792 width=40) (actual time=987.619..1,448.357 rows=150,157 loops=1)

  • Hash Cond: ((c_1.id_faktury = a_1_1.id_faktury) AND (c_1.id_towaru = b_1_1.id_towaru) AND (c_1.id_korygowanej = b_1_1.id_korygowanej))
16. 505.523 505.523 ↑ 1.0 303,849 1

Seq Scan on spd_faktura_pozycje c_1 (cost=0.00..217,602.86 rows=305,266 width=28) (actual time=0.210..505.523 rows=303,849 loops=1)

  • Filter: (nazwa ~~ 'Winno być :%'::text)
  • Rows Removed by Filter: 1579442
17. 33.946 631.903 ↓ 1.1 134,553 1

Hash (cost=223,949.24..223,949.24 rows=125,792 width=28) (actual time=631.903..631.903 rows=134,553 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 7783kB
18. 97.416 597.957 ↓ 1.1 134,553 1

Hash Right Join (cost=310.38..223,949.24 rows=125,792 width=28) (actual time=252.869..597.957 rows=134,553 loops=1)

  • Hash Cond: (b_1_1.id_faktury = a_1_1.id_faktury)
19. 497.586 497.586 ↑ 1.0 303,854 1

Seq Scan on spd_faktura_pozycje b_1_1 (cost=0.00..217,602.86 rows=318,538 width=28) (actual time=0.119..497.586 rows=303,854 loops=1)

  • Filter: (nazwa ~~ 'Było :%'::text)
  • Rows Removed by Filter: 1579437
20. 1.482 2.955 ↓ 1.0 10,163 1

Hash (cost=184.06..184.06 rows=10,106 width=4) (actual time=2.955..2.955 rows=10,163 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 358kB
21. 1.473 1.473 ↓ 1.0 10,163 1

Seq Scan on spd_faktura_reklamacje a_1_1 (cost=0.00..184.06 rows=10,106 width=4) (actual time=0.004..1.473 rows=10,163 loops=1)

22. 1.954 4.962 ↓ 1.0 10,163 1

Hash (cost=286.66..286.66 rows=10,106 width=48) (actual time=4.962..4.962 rows=10,163 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 604kB
23. 2.124 3.008 ↓ 1.0 10,163 1

Hash Left Join (cost=1.58..286.66 rows=10,106 width=48) (actual time=0.033..3.008 rows=10,163 loops=1)

  • Hash Cond: (przyczyny_id.id_przyczyny = przyczyny.id)
24. 0.862 0.862 ↓ 1.0 10,163 1

Seq Scan on spd_faktura_reklamacje przyczyny_id (cost=0.00..184.06 rows=10,106 width=8) (actual time=0.004..0.862 rows=10,163 loops=1)

25. 0.008 0.022 ↑ 1.0 26 1

Hash (cost=1.26..1.26 rows=26 width=48) (actual time=0.022..0.022 rows=26 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 3kB
26. 0.014 0.014 ↑ 1.0 26 1

Seq Scan on spd_faktura_reklamacje_slw przyczyny (cost=0.00..1.26 rows=26 width=48) (actual time=0.007..0.014 rows=26 loops=1)

27. 1,532.966 285,016.734 ↓ 1.7 1,060,958 1

Hash (cost=8,076,528.92..8,076,528.92 rows=615,209 width=339) (actual time=285,016.734..285,016.734 rows=1,060,958 loops=1)

  • Buckets: 32768 Batches: 4 Memory Usage: 75521kB
28. 816.158 283,483.768 ↓ 1.7 1,060,958 1

Hash Left Join (cost=59,089.54..8,076,528.92 rows=615,209 width=339) (actual time=726.222..283,483.768 rows=1,060,958 loops=1)

  • Hash Cond: (a_1.id_odbiorcy = e.id_kontrahenta)
29. 827.411 282,654.579 ↓ 1.7 1,060,958 1

Hash Left Join (cost=53,368.73..8,056,196.90 rows=615,209 width=318) (actual time=713.173..282,654.579 rows=1,060,958 loops=1)

  • Hash Cond: (b_1.id_towaru = d.id_indeksu)
30. 951.592 281,822.512 ↓ 1.7 1,060,958 1

Hash Left Join (cost=52,428.36..8,042,952.35 rows=615,209 width=227) (actual time=708.503..281,822.512 rows=1,060,958 loops=1)

  • Hash Cond: (a_1.id_platnika = c.id_kontrahenta)
31. 746.973 280,822.652 ↓ 1.7 1,060,958 1

Hash Left Join (cost=21,816.49..7,997,729.26 rows=615,209 width=196) (actual time=660.223..280,822.652 rows=1,060,958 loops=1)

  • Hash Cond: (zest.id_skladnika = zest_nazw.id_indeksu)
32. 997.582 280,068.308 ↓ 1.7 1,060,958 1

Nested Loop Left Join (cost=20,673.05..7,984,281.64 rows=615,209 width=96) (actual time=652.847..280,068.308 rows=1,060,958 loops=1)

33. 1,834.619 2,665.756 ↓ 1.6 969,842 1

Hash Join (cost=20,672.80..263,408.44 rows=615,209 width=76) (actual time=649.945..2,665.756 rows=969,842 loops=1)

  • Hash Cond: (b_1.id_faktury = a_1.id)
34. 743.154 743.154 ↑ 1.0 1,883,291 1

Seq Scan on spd_faktura_pozycje b_1 (cost=0.00..212,857.69 rows=1,898,069 width=33) (actual time=0.002..743.154 rows=1,883,291 loops=1)

35. 15.667 87.983 ↓ 1.7 56,427 1

Hash (cost=20,262.65..20,262.65 rows=32,812 width=43) (actual time=87.983..87.983 rows=56,427 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 4409kB
36. 63.286 72.316 ↓ 1.7 56,427 1

Bitmap Heap Scan on spd_faktura_naglowki a_1 (cost=1,367.70..20,262.65 rows=32,812 width=43) (actual time=9.559..72.316 rows=56,427 loops=1)

  • Recheck Cond: (data_wyst >= $0)
  • Filter: ((gotowa = 1) AND (btrim((rodzaj_dokumentu)::text) <> 'F.ZAL'::text))
  • Rows Removed by Filter: 1399
37. 9.030 9.030 ↓ 1.7 58,402 1

Bitmap Index Scan on spd_fan_sort_data (cost=0.00..1,359.50 rows=33,744 width=0) (actual time=9.030..9.030 rows=58,402 loops=1)

  • Index Cond: (data_wyst >= $0)
38. 276,404.970 276,404.970 ↓ 0.0 0 969,842

Function Scan on zestaw_wielopoziomowy_proporcje zest (cost=0.25..12.75 rows=5 width=24) (actual time=0.285..0.285 rows=0 loops=969,842)

  • Filter: (b_1.id_towaru = id_zestawu)
39. 2.241 7.371 ↓ 1.0 6,570 1

Hash (cost=1,061.53..1,061.53 rows=6,553 width=104) (actual time=7.371..7.371 rows=6,570 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 889kB
40. 5.130 5.130 ↓ 1.0 6,570 1

Seq Scan on gm_indeksy zest_nazw (cost=0.00..1,061.53 rows=6,553 width=104) (actual time=0.020..5.130 rows=6,570 loops=1)

41. 4.862 48.268 ↑ 1.0 18,708 1

Hash (cost=30,377.14..30,377.14 rows=18,778 width=35) (actual time=48.268..48.268 rows=18,708 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 1270kB
42. 43.406 43.406 ↑ 1.0 18,708 1

Index Scan using spd_kon_auto on spd_kontrahenci c (cost=0.41..30,377.14 rows=18,778 width=35) (actual time=0.009..43.406 rows=18,708 loops=1)

43. 1.747 4.656 ↓ 1.0 6,570 1

Hash (cost=858.46..858.46 rows=6,553 width=95) (actual time=4.656..4.656 rows=6,570 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 828kB
44. 2.909 2.909 ↓ 1.0 6,570 1

Index Only Scan using gm_ind_u_nazwa on gm_indeksy d (cost=0.41..858.46 rows=6,553 width=95) (actual time=0.041..2.909 rows=6,570 loops=1)

  • Heap Fetches: 1943
45. 3.812 13.031 ↑ 1.0 18,708 1

Hash (cost=5,486.08..5,486.08 rows=18,778 width=25) (actual time=13.031..13.031 rows=18,708 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 1097kB
46. 9.219 9.219 ↑ 1.0 18,708 1

Index Only Scan using spd_kon_sort_skrot on spd_kontrahenci e (cost=0.41..5,486.08 rows=18,778 width=25) (actual time=0.034..9.219 rows=18,708 loops=1)

  • Heap Fetches: 8836
47. 0.002 0.008 ↓ 1.8 9 1

Hash (cost=1.05..1.05 rows=5 width=45) (actual time=0.008..0.008 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
48. 0.006 0.006 ↓ 1.8 9 1

Seq Scan on spd_kontrahenci_rodzaje2 g (cost=0.00..1.05 rows=5 width=45) (actual time=0.004..0.006 rows=9 loops=1)

49. 0.004 0.008 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=47) (actual time=0.008..0.008 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
50. 0.004 0.004 ↑ 1.0 6 1

Seq Scan on spd_regiony h (cost=0.00..1.06 rows=6 width=47) (actual time=0.004..0.004 rows=6 loops=1)

51. 4.247 56.597 ↑ 32.7 6,570 1

Hash (cost=7,998.58..7,998.58 rows=214,709 width=452) (actual time=56.597..56.597 rows=6,570 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 1411kB
52. 9.336 52.350 ↑ 32.7 6,570 1

Merge Left Join (cost=3,085.72..7,998.58 rows=214,709 width=452) (actual time=42.170..52.350 rows=6,570 loops=1)

  • Merge Cond: (((x.pole_sort)::text) = ((x_post.id_indeksu)::text))
53. 3.462 10.092 ↓ 1.0 6,570 1

Sort (cost=1,097.79..1,114.17 rows=6,553 width=55) (actual time=9.748..10.092 rows=6,570 loops=1)

  • Sort Key: ((x.pole_sort)::text)
  • Sort Method: quicksort Memory: 1116kB
54. 6.630 6.630 ↓ 1.0 6,570 1

Index Only Scan using gm_ind_f_sort on gm_indeksy x (cost=0.41..682.39 rows=6,553 width=55) (actual time=0.056..6.630 rows=6,570 loops=1)

  • Heap Fetches: 1943
55. 19.358 32.922 ↓ 1.2 7,549 1

Sort (cost=1,987.93..2,004.31 rows=6,553 width=448) (actual time=32.417..32.922 rows=7,549 loops=1)

  • Sort Key: ((x_post.id_indeksu)::text)
  • Sort Method: quicksort Memory: 3580kB
56. 2.148 13.564 ↓ 1.0 6,570 1

Hash Left Join (cost=109.69..1,572.54 rows=6,553 width=448) (actual time=0.815..13.564 rows=6,570 loops=1)

  • Hash Cond: (x_post.id_indeksu = x_dod.id_indeksu)
57. 1.656 10.814 ↓ 1.0 6,570 1

Hash Left Join (cost=32.18..1,454.12 rows=6,553 width=444) (actual time=0.207..10.814 rows=6,570 loops=1)

  • Hash Cond: (x_post.rodzaj_materialu4 = x4.id_rodzaju)
58. 1.576 9.040 ↓ 1.0 6,570 1

Hash Left Join (cost=9.69..1,341.53 rows=6,553 width=367) (actual time=0.084..9.040 rows=6,570 loops=1)

  • Hash Cond: (x_post.rodzaj_materialu3 = x3.id_rodzaju)
59. 1.399 7.430 ↓ 1.0 6,570 1

Hash Left Join (cost=4.61..1,246.35 rows=6,553 width=290) (actual time=0.043..7.430 rows=6,570 loops=1)

  • Hash Cond: (x_post.rodzaj_materialu2 = x2.id_rodzaju)
60. 4.653 6.023 ↓ 1.0 6,570 1

Hash Left Join (cost=2.25..1,153.88 rows=6,553 width=213) (actual time=0.026..6.023 rows=6,570 loops=1)

  • Hash Cond: (x_post.rodzaj_materialu1 = x1.id_rodzaju)
61. 1.355 1.355 ↓ 1.0 6,570 1

Seq Scan on gm_indeksy x_post (cost=0.00..1,061.53 rows=6,553 width=136) (actual time=0.003..1.355 rows=6,570 loops=1)

62. 0.005 0.015 ↑ 1.0 11 1

Hash (cost=2.11..2.11 rows=11 width=85) (actual time=0.015..0.015 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
63. 0.010 0.010 ↑ 1.0 11 1

Seq Scan on gm_indeksy_rodzaj1 x1 (cost=0.00..2.11 rows=11 width=85) (actual time=0.006..0.010 rows=11 loops=1)

64. 0.001 0.008 ↑ 2.0 8 1

Hash (cost=2.16..2.16 rows=16 width=85) (actual time=0.008..0.008 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
65. 0.007 0.007 ↑ 2.0 8 1

Seq Scan on gm_indeksy_rodzaj2 x2 (cost=0.00..2.16 rows=16 width=85) (actual time=0.003..0.007 rows=8 loops=1)

66. 0.010 0.034 ↑ 1.0 48 1

Hash (cost=4.48..4.48 rows=48 width=85) (actual time=0.034..0.034 rows=48 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 6kB
67. 0.024 0.024 ↑ 1.0 48 1

Seq Scan on gm_indeksy_rodzaj3 x3 (cost=0.00..4.48 rows=48 width=85) (actual time=0.003..0.024 rows=48 loops=1)

68. 0.033 0.118 ↑ 1.0 155 1

Hash (cost=20.55..20.55 rows=155 width=85) (actual time=0.118..0.118 rows=155 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
69. 0.085 0.085 ↑ 1.0 155 1

Seq Scan on gm_indeksy_rodzaj4 x4 (cost=0.00..20.55 rows=155 width=85) (actual time=0.005..0.085 rows=155 loops=1)

70. 0.129 0.602 ↓ 1.0 826 1

Hash (cost=67.34..67.34 rows=814 width=8) (actual time=0.602..0.602 rows=826 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 33kB
71. 0.473 0.473 ↓ 1.0 826 1

Seq Scan on gm_indeksy_info_dodatkowe x_dod (cost=0.00..67.34 rows=814 width=8) (actual time=0.006..0.473 rows=826 loops=1)

  • Filter: (rodzaj_info = 1)
  • Rows Removed by Filter: 2661
72. 1.051 4.367 ↓ 1.1 4,358 1

Hash (cost=496.28..496.28 rows=3,843 width=66) (actual time=4.367..4.367 rows=4,358 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 419kB
73. 1.074 3.316 ↓ 1.1 4,358 1

Hash Left Join (cost=283.19..496.28 rows=3,843 width=66) (actual time=1.412..3.316 rows=4,358 loops=1)

  • Hash Cond: (a.kompletujacy = b.kod)
74. 1.016 1.016 ↓ 1.1 4,358 1

Seq Scan on spd_faktura_reklamacje a (cost=0.00..184.06 rows=3,843 width=8) (actual time=0.174..1.016 rows=4,358 loops=1)

  • Filter: (kompletujacy IS NOT NULL)
  • Rows Removed by Filter: 5805
75. 0.259 1.226 ↓ 1.0 1,027 1

Hash (cost=270.42..270.42 rows=1,022 width=66) (actual time=1.226..1.226 rows=1,027 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 101kB
76. 0.967 0.967 ↓ 1.0 1,027 1

Index Only Scan using ks_pra_f_klucz on ks_pracownicy b (cost=0.28..270.42 rows=1,022 width=66) (actual time=0.020..0.967 rows=1,027 loops=1)

  • Heap Fetches: 362
77. 2.459 31.140 ↓ 1,066.8 14,935 1

Hash (cost=2,967.83..2,967.83 rows=14 width=4) (actual time=31.140..31.140 rows=14,935 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 526kB
78. 6.974 28.681 ↓ 1,066.8 14,935 1

Hash Join (cost=1,497.12..2,967.83 rows=14 width=4) (actual time=19.515..28.681 rows=14,935 loops=1)

  • Hash Cond: ((spd_kontrahenci_hand.id_kontrahenta = aa.id_kontrahenta) AND ((max(spd_kontrahenci_hand.od_kiedy)) = aa.od_kiedy))
79. 9.784 11.775 ↓ 1.0 14,935 1

HashAggregate (cost=606.92..750.39 rows=14,347 width=8) (actual time=9.561..11.775 rows=14,935 loops=1)

80. 1.991 1.991 ↓ 1.0 28,386 1

Seq Scan on spd_kontrahenci_hand (cost=0.00..465.28 rows=28,328 width=8) (actual time=0.004..1.991 rows=28,386 loops=1)

81. 5.569 9.932 ↓ 1.0 28,386 1

Hash (cost=465.28..465.28 rows=28,328 width=12) (actual time=9.932..9.932 rows=28,386 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 1220kB
82. 4.363 4.363 ↓ 1.0 28,386 1

Seq Scan on spd_kontrahenci_hand aa (cost=0.00..465.28 rows=28,328 width=12) (actual time=0.011..4.363 rows=28,386 loops=1)

83. 0.003 0.011 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=20) (actual time=0.011..0.011 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
84. 0.008 0.008 ↑ 1.0 5 1

Seq Scan on gm_indeksy_statusy x_stat (cost=0.00..1.05 rows=5 width=20) (actual time=0.008..0.008 rows=5 loops=1)

85. 2.723 1,502.896 ↓ 18.7 18,708 1

Hash (cost=10.25..10.25 rows=1,000 width=36) (actual time=1,502.896..1,502.896 rows=18,708 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1023kB
86. 1,500.173 1,500.173 ↓ 18.7 18,708 1

Function Scan on spd_kontrahenci_regiony reg (cost=0.25..10.25 rows=1,000 width=36) (actual time=1,498.302..1,500.173 rows=18,708 loops=1)

Total runtime : 358,048.038 ms