explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kN39

Settings
# exclusive inclusive rows x rows loops node
1. 1,478.163 2,091.220 ↑ 1.2 18,708 1

Hash Right Join (cost=47,463.58..556,689.86 rows=22,440 width=1,877) (actual time=297.481..2,091.220 rows=18,708 loops=1)

  • Hash Cond: (k.id_kontrahenta = a.id_kontrahenta)
2. 16.644 16.644 ↓ 1.0 14,199 1

Index Only Scan using spd_kin_f_wart1 on spd_kontrahenci_info_dodatkow k (cost=0.42..8,651.97 rows=14,030 width=8) (actual time=0.015..16.644 rows=14,199 loops=1)

  • Index Cond: (rodzaj_info = 1)
  • Heap Fetches: 12557
3. 35.339 297.085 ↑ 1.2 18,708 1

Hash (cost=47,182.66..47,182.66 rows=22,440 width=1,873) (actual time=297.085..297.085 rows=18,708 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 33445kB
4. 28.966 261.746 ↑ 1.2 18,708 1

Hash Right Join (cost=46,169.70..47,182.66 rows=22,440 width=1,873) (actual time=217.672..261.746 rows=18,708 loops=1)

  • Hash Cond: (j.id_kontrahenta = a.id_kontrahenta)
5. 12.629 90.243 ↑ 1.1 18,709 1

Merge Right Join (cost=10,461.91..10,983.12 rows=20,705 width=125) (actual time=75.123..90.243 rows=18,709 loops=1)

  • Merge Cond: ((btrim((i.kraj)::text)) = (btrim((j.pole_s1)::text)))
6. 0.368 0.567 ↑ 1.0 238 1

Sort (cost=100.83..101.43 rows=239 width=142) (actual time=0.543..0.567 rows=238 loops=1)

  • Sort Key: (btrim((i.kraj)::text))
  • Sort Method: quicksort Memory: 88kB
7. 0.199 0.199 ↑ 1.0 239 1

Seq Scan on spd_kraje i (cost=0.00..91.39 rows=239 width=142) (actual time=0.008..0.199 rows=239 loops=1)

8. 18.951 77.047 ↓ 1.1 18,709 1

Sort (cost=10,361.08..10,404.39 rows=17,326 width=258) (actual time=74.573..77.047 rows=18,709 loops=1)

  • Sort Key: (btrim((j.pole_s1)::text))
  • Sort Method: quicksort Memory: 10415kB
9. 56.388 58.096 ↓ 1.1 18,709 1

Bitmap Heap Scan on spd_kontrahenci_info_dodatkow j (cost=388.69..9,141.27 rows=17,326 width=258) (actual time=2.186..58.096 rows=18,709 loops=1)

  • Recheck Cond: (rodzaj_info = 28)
10. 1.708 1.708 ↓ 1.1 18,709 1

Bitmap Index Scan on spd_kin_auto (cost=0.00..384.36 rows=17,326 width=0) (actual time=1.708..1.708 rows=18,709 loops=1)

  • Index Cond: (rodzaj_info = 28)
11. 37.355 142.537 ↑ 1.0 18,708 1

Hash (cost=35,473.07..35,473.07 rows=18,778 width=1,752) (actual time=142.537..142.537 rows=18,708 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 31235kB
12. 12.385 105.182 ↑ 1.0 18,708 1

Hash Left Join (cost=3,153.63..35,473.07 rows=18,778 width=1,752) (actual time=25.809..105.182 rows=18,708 loops=1)

  • Hash Cond: (a.id_kontrahenta = spd_kontrahenci_hand.id_kontrahenta)
13. 6.573 67.231 ↑ 1.0 18,708 1

Hash Left Join (cost=37.22..32,001.94 rows=18,778 width=1,544) (actual time=0.238..67.231 rows=18,708 loops=1)

  • Hash Cond: (a.kto = g.id_uzytkownika)
14. 6.386 60.505 ↑ 1.0 18,708 1

Hash Left Join (cost=8.09..31,714.61 rows=18,778 width=1,483) (actual time=0.080..60.505 rows=18,708 loops=1)

  • Hash Cond: (a.id_grupy_cennik = f.id)
15. 5.688 54.109 ↑ 1.0 18,708 1

Hash Left Join (cost=6.59..31,455.84 rows=18,778 width=1,382) (actual time=0.065..54.109 rows=18,708 loops=1)

  • Hash Cond: (a.grupa_rabatowa = e.id_grupy)
16. 6.025 48.392 ↑ 1.0 18,708 1

Hash Left Join (cost=2.95..31,212.26 rows=18,778 width=1,331) (actual time=0.033..48.392 rows=18,708 loops=1)

  • Hash Cond: (a.id_rodzaju3 = d.id_rodzaju)
17. 5.987 42.359 ↑ 1.0 18,708 1

Hash Left Join (cost=1.66..30,987.98 rows=18,778 width=1,290) (actual time=0.021..42.359 rows=18,708 loops=1)

  • Hash Cond: (a.id_rodzaju1 = b.id_rodzaju)
18. 21.351 36.367 ↑ 1.0 18,708 1

Merge Right Join (cost=0.54..30,760.23 rows=18,778 width=1,249) (actual time=0.012..36.367 rows=18,708 loops=1)

  • Merge Cond: (c.id_rodzaju = a.id_rodzaju2)
19. 0.009 0.009 ↓ 1.8 9 1

Index Scan using spd_rk2_auto on spd_kontrahenci_rodzaje2 c (cost=0.13..6.21 rows=5 width=45) (actual time=0.003..0.009 rows=9 loops=1)

20. 15.007 15.007 ↑ 1.0 18,708 1

Index Scan using spd_kon_f_rodzaj2 on spd_kontrahenci a (cost=0.41..30,621.71 rows=18,778 width=1,208) (actual time=0.006..15.007 rows=18,708 loops=1)

21. 0.003 0.005 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
22. 0.002 0.002 ↑ 1.0 5 1

Seq Scan on spd_kontrahenci_rodzaje1 b (cost=0.00..1.05 rows=5 width=45) (actual time=0.002..0.002 rows=5 loops=1)

23. 0.003 0.008 ↓ 1.6 21 1

Hash (cost=1.13..1.13 rows=13 width=45) (actual time=0.008..0.008 rows=21 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
24. 0.005 0.005 ↓ 1.6 21 1

Seq Scan on spd_kontrahenci_rodzaje3 d (cost=0.00..1.13 rows=13 width=45) (actual time=0.002..0.005 rows=21 loops=1)

25. 0.016 0.029 ↓ 1.0 74 1

Hash (cost=2.73..2.73 rows=73 width=55) (actual time=0.029..0.029 rows=74 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
26. 0.013 0.013 ↓ 1.0 74 1

Seq Scan on spd_kontrahenci_grupy_rabatow e (cost=0.00..2.73 rows=73 width=55) (actual time=0.003..0.013 rows=74 loops=1)

27. 0.005 0.010 ↑ 1.0 22 1

Hash (cost=1.22..1.22 rows=22 width=105) (actual time=0.010..0.010 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 4kB
28. 0.005 0.005 ↑ 1.0 22 1

Seq Scan on spd_grupy_cennikowe f (cost=0.00..1.22 rows=22 width=105) (actual time=0.002..0.005 rows=22 loops=1)

29. 0.057 0.153 ↑ 1.0 317 1

Hash (cost=25.17..25.17 rows=317 width=65) (actual time=0.153..0.153 rows=317 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
30. 0.096 0.096 ↑ 1.0 317 1

Seq Scan on adm_uzytkownicy g (cost=0.00..25.17 rows=317 width=65) (actual time=0.003..0.096 rows=317 loops=1)

31. 4.368 25.566 ↓ 1.0 14,935 1

Hash (cost=2,937.07..2,937.07 rows=14,347 width=212) (actual time=25.566..25.566 rows=14,935 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 3564kB
32. 3.623 21.198 ↓ 1.0 14,935 1

Hash Left Join (cost=2,565.16..2,937.07 rows=14,347 width=212) (actual time=12.997..21.198 rows=14,935 loops=1)

  • Hash Cond: (spd_kontrahenci_hand.id_handlowca = b_1.kod)
33. 3.126 17.548 ↓ 1.0 14,935 1

Unique (cost=2,560.13..2,701.77 rows=14,347 width=12) (actual time=12.963..17.548 rows=14,935 loops=1)

34. 10.941 14.422 ↓ 1.0 28,386 1

Sort (cost=2,560.13..2,630.95 rows=28,328 width=12) (actual time=12.963..14.422 rows=28,386 loops=1)

  • Sort Key: spd_kontrahenci_hand.id_kontrahenta, spd_kontrahenci_hand.od_kiedy
  • Sort Method: quicksort Memory: 2099kB
35. 3.481 3.481 ↓ 1.0 28,386 1

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

36. 0.010 0.027 ↓ 1.0 48 1

Hash (cost=4.46..4.46 rows=46 width=208) (actual time=0.027..0.027 rows=48 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
37. 0.017 0.017 ↓ 1.0 48 1

Seq Scan on spd_handlowcy b_1 (cost=0.00..4.46 rows=46 width=208) (actual time=0.003..0.017 rows=48 loops=1)

38.          

SubPlan (for Hash Right Join)

39. 43.629 261.912 ↑ 1.0 1 18,708

Nested Loop Left Join (cost=4.88..16.83 rows=1 width=259) (actual time=0.013..0.014 rows=1 loops=18,708)

40. 24.921 205.788 ↑ 1.0 1 18,708

Nested Loop Left Join (cost=4.75..16.52 rows=1 width=208) (actual time=0.010..0.011 rows=1 loops=18,708)

41. 12.357 168.372 ↑ 1.0 1 18,708

Nested Loop (cost=4.61..12.35 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=18,708)

  • Join Filter: (r.od_kiedy = (max(spd_kontrahenci_hand_1.od_kiedy)))
  • Rows Removed by Join Filter: 1
42. 37.416 93.540 ↑ 2.0 1 18,708

GroupAggregate (cost=2.30..6.15 rows=2 width=8) (actual time=0.005..0.005 rows=1 loops=18,708)

43. 18.708 56.124 ↑ 2.0 1 18,708

Bitmap Heap Scan on spd_kontrahenci_hand spd_kontrahenci_hand_1 (cost=2.30..6.12 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=18,708)

  • Recheck Cond: (id_kontrahenta = a.id_platnika)
44. 37.416 37.416 ↑ 2.0 1 18,708

Bitmap Index Scan on spd_hak_auto (cost=0.00..2.30 rows=2 width=0) (actual time=0.002..0.002 rows=1 loops=18,708)

  • Index Cond: (id_kontrahenta = a.id_platnika)
45. 24.990 62.475 ↑ 1.0 2 12,495

Materialize (cost=2.30..6.13 rows=2 width=12) (actual time=0.004..0.005 rows=2 loops=12,495)

46. 12.495 37.485 ↑ 1.0 2 12,495

Bitmap Heap Scan on spd_kontrahenci_hand r (cost=2.30..6.12 rows=2 width=12) (actual time=0.003..0.003 rows=2 loops=12,495)

  • Recheck Cond: (id_kontrahenta = a.id_platnika)
47. 24.990 24.990 ↑ 1.0 2 12,495

Bitmap Index Scan on spd_hak_auto (cost=0.00..2.30 rows=2 width=0) (actual time=0.002..0.002 rows=2 loops=12,495)

  • Index Cond: (id_kontrahenta = a.id_platnika)
48. 12.495 12.495 ↑ 1.0 1 12,495

Index Scan using spd_han_auto on spd_handlowcy s (cost=0.14..4.16 rows=1 width=212) (actual time=0.001..0.001 rows=1 loops=12,495)

  • Index Cond: (r.id_handlowca = kod)
49. 12.495 12.495 ↑ 1.0 1 12,495

Index Scan using spd_hsi_auto on spd_handlowcy_sieci t (cost=0.14..0.28 rows=1 width=55) (actual time=0.001..0.001 rows=1 loops=12,495)

  • Index Cond: (s.id_sieci = id)
50. 37.416 37.416 ↓ 0.0 0 18,708

Index Scan using spd_kin_sort_kontrahent on spd_kontrahenci_info_dodatkow (cost=0.42..4.44 rows=1 width=254) (actual time=0.002..0.002 rows=0 loops=18,708)

  • Index Cond: ((id_kontrahenta = a.id_kontrahenta) AND (rodzaj_info = 75))
Total runtime : 2,093.144 ms