explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ydDz

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

Hash Right Join (cost=46,169.70..646,939.25 rows=22,440 width=1,873) (actual time=217.649..2,119.068 rows=18,708 loops=1)

  • Hash Cond: (j.id_kontrahenta = a.id_kontrahenta)
2. 27.860 107.554 ↑ 1.1 18,709 1

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

  • Merge Cond: ((btrim((i.kraj)::text)) = (btrim((j.pole_s1)::text)))
3. 0.355 0.578 ↑ 1.0 238 1

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

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

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

5. 21.201 79.116 ↓ 1.1 18,709 1

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

  • Sort Key: (btrim((j.pole_s1)::text))
  • Sort Method: quicksort Memory: 10415kB
6. 56.200 57.915 ↓ 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.191..57.915 rows=18,709 loops=1)

  • Recheck Cond: (rodzaj_info = 28)
7. 1.715 1.715 ↓ 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.715..1.715 rows=18,709 loops=1)

  • Index Cond: (rodzaj_info = 28)
8. 37.298 142.331 ↑ 1.0 18,708 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 31235kB
9. 12.236 105.033 ↑ 1.0 18,708 1

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

  • Hash Cond: (a.id_kontrahenta = spd_kontrahenci_hand.id_kontrahenta)
10. 6.409 67.086 ↑ 1.0 18,708 1

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

  • Hash Cond: (a.kto = g.id_uzytkownika)
11. 6.359 60.535 ↑ 1.0 18,708 1

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

  • Hash Cond: (a.id_grupy_cennik = f.id)
12. 5.917 54.167 ↑ 1.0 18,708 1

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

  • Hash Cond: (a.grupa_rabatowa = e.id_grupy)
13. 5.926 48.226 ↑ 1.0 18,708 1

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

  • Hash Cond: (a.id_rodzaju3 = d.id_rodzaju)
14. 6.060 42.292 ↑ 1.0 18,708 1

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

  • Hash Cond: (a.id_rodzaju1 = b.id_rodzaju)
15. 20.835 36.226 ↑ 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.226 rows=18,708 loops=1)

  • Merge Cond: (c.id_rodzaju = a.id_rodzaju2)
16. 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.002..0.009 rows=9 loops=1)

17. 15.382 15.382 ↑ 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.382 rows=18,708 loops=1)

18. 0.004 0.006 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
19. 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.001..0.002 rows=5 loops=1)

20. 0.001 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
21. 0.007 0.007 ↓ 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.007 rows=21 loops=1)

22. 0.019 0.024 ↓ 1.0 74 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
23. 0.005 0.005 ↓ 1.0 74 1

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

24. 0.006 0.009 ↑ 1.0 22 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 4kB
25. 0.003 0.003 ↑ 1.0 22 1

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

26. 0.059 0.142 ↑ 1.0 317 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
27. 0.083 0.083 ↑ 1.0 317 1

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

28. 4.251 25.711 ↓ 1.0 14,935 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 3564kB
29. 3.673 21.460 ↓ 1.0 14,935 1

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

  • Hash Cond: (spd_kontrahenci_hand.id_handlowca = b_1.kod)
30. 3.093 17.759 ↓ 1.0 14,935 1

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

31. 11.257 14.666 ↓ 1.0 28,386 1

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

  • Sort Key: spd_kontrahenci_hand.id_kontrahenta, spd_kontrahenci_hand.od_kiedy
  • Sort Method: quicksort Memory: 2099kB
32. 3.409 3.409 ↓ 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.409 rows=28,386 loops=1)

33. 0.013 0.028 ↓ 1.0 48 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
34. 0.015 0.015 ↓ 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.015 rows=48 loops=1)

35.          

SubPlan (for Hash Right Join)

36. 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)

37. 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)

38. 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
39. 18.708 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)

40. 37.416 74.832 ↑ 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.004 rows=1 loops=18,708)

  • Recheck Cond: (id_kontrahenta = a.id_platnika)
41. 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)
42. 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)

43. 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)
44. 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)
45. 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)
46. 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)
47. 56.124 56.124 ↑ 1.0 1 18,708

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

  • Index Cond: ((id_kontrahenta = a.id_kontrahenta) AND (rodzaj_info = 1))
48. 37.416 37.416 ↓ 0.0 0 18,708

Index Scan using spd_kin_sort_kontrahent on spd_kontrahenci_info_dodatkow spd_kontrahenci_info_dodatkow_1 (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,120.823 ms