query-plan-1169

Change label
Query Plan as raw text
Summary
Time Node
Node (ms) Percent
54318.192 100.00%
 Unique (cost=24251.65..25289.53 rows=1 width=87) (actual time=2433.184..54318.192 rows=200 loops=1)
54316.749 100.00%
  -> Nested Loop Left Join (cost=24251.65..25289.53 rows=1 width=87) (actual time=2433.177..54316.749 rows=200 loops=1)
54312.352 99.99%
        -> Nested Loop Left Join (cost=24251.65..25281.24 rows=1 width=87) (actual time=2433.149..54312.352 rows=200 loops=1)
54307.456 99.98%
              -> Nested Loop Left Join (cost=24251.65..25272.96 rows=1 width=83) (actual time=2433.065..54307.456 rows=200 loops=1)
54300.297 99.97%
                    -> Nested Loop Left Join (cost=24251.65..25264.68 rows=1 width=75) (actual time=2433.010..54300.297 rows=200 loops=1)
                          Join Filter: (s.klient = klienci.id)
827.454 1.52%
                          -> Nested Loop Left Join (cost=14414.52..14515.65 rows=1 width=75) (actual time=820.333..827.454 rows=200 loops=1)
822.057 1.51%
                                -> Merge Left Join (cost=14414.52..14507.36 rows=1 width=52) (actual time=820.297..822.057 rows=200 loops=1)
                                      Merge Cond: (klienci.id = v_klienci_konczace_sie_umowy.klient_id)
4.417 0.01%
                                      -> Sort (cost=127.34..127.34 rows=1 width=52) (actual time=3.951..4.417 rows=200 loops=1)
                                            Sort Key: klienci.id
                                            Sort Method:  quicksort  Memory: 38kB
3.391 0.01%
                                            -> Index Scan using id_zrodla_idx on klienci (cost=0.0..127.33 rows=1 width=52) (actual time=0.129..3.391 rows=200 loops=1)
                                                  Index Cond: (id_zrodla = 1)
                                                  Filter: ((active IS TRUE) AND (czas_dodania >= '2008-10-01 00:00:00'::timestamp without time zone) AND (czas_dodania <= '2008-10-29 00:00:00'::timestamp without time zone) AND (wprowadzil = 130))
808.291 1.49%
                                      -> Materialize (cost=14287.18..14361.44 rows=7426 width=8) (actual time=746.348..808.291 rows=5737 loops=1)
792.437 1.46%
                                            -> Subquery Scan v_klienci_konczace_sie_umowy (cost=14131.24..14279.76 rows=7426 width=8) (actual time=746.342..792.437 rows=5737 loops=1)
777.226 1.43%
                                                  -> Unique (cost=14131.24..14205.5 rows=7426 width=19) (actual time=746.338..777.226 rows=5737 loops=1)
756.180 1.39%
                                                        -> Sort (cost=14131.24..14149.8 rows=7426 width=19) (actual time=746.333..756.180 rows=7625 loops=1)
                                                              Sort Key: "*SELECT* 1".klient_id, "*SELECT* 1".data_umowa, (0::numeric)
                                                              Sort Method:  quicksort  Memory: 426kB
724.817 1.33%
                                                              -> Append (cost=0.0..13653.8 rows=7426 width=19) (actual time=0.039..724.817 rows=7625 loops=1)
15.624 0.03%
                                                                    -> Subquery Scan "*SELECT* 1" (cost=0.0..1042.66 rows=576 width=12) (actual time=0.036..15.624 rows=754 loops=1)
13.532 0.02%
                                                                          -> Seq Scan on klienci_szczegoly k (cost=0.0..1036.9 rows=576 width=12) (actual time=0.033..13.532 rows=754 loops=1)
                                                                                Filter: (umowa_do IS NOT NULL)
553.881 1.02%
                                                                    -> Nested Loop (cost=5182.53..6290.2 rows=2528 width=19) (actual time=473.361..553.881 rows=2476 loops=1)
514.142 0.95%
                                                                          -> Hash Join (cost=5182.53..5515.0 rows=2528 width=19) (actual time=473.309..514.142 rows=2476 loops=1)
                                                                                Hash Cond: (s2s.spotkanie_id = public.spotkania.id)
46.118 0.08%
                                                                                -> Hash Join (cost=147.54..419.97 rows=2528 width=19) (actual time=15.651..46.118 rows=2476 loops=1)
                                                                                      Hash Cond: (sprz.id = s2s.propozycja_id)
15.141 0.03%
                                                                                      -> Seq Scan on oferta_utrz sprz (cost=0.0..192.54 rows=6241 width=15) (actual time=0.024..15.141 rows=6240 loops=1)
                                                                                            Filter: (umowa_zawarta_na IS NOT NULL)
15.540 0.03%
                                                                                      -> Hash (cost=83.35..83.35 rows=5135 width=16) (actual time=15.540..15.540 rows=2486 loops=1)
8.087 0.01%
                                                                                            -> Seq Scan on spotkania2sprzedaz s2s (cost=0.0..83.35 rows=5135 width=16) (actual time=0.020..8.087 rows=5135 loops=1)
457.562 0.84%
                                                                                -> Hash (cost=3282.22..3282.22 rows=140222 width=16) (actual time=457.562..457.562 rows=140222 loops=1)
222.909 0.41%
                                                                                      -> Seq Scan on spotkania (cost=0.0..3282.22 rows=140222 width=16) (actual time=0.020..222.909 rows=140222 loops=1)
24.760 0.05%
                                                                          -> Index Scan using klienci_pkey on klienci k (cost=0.0..0.29 rows=1 width=8) (actual time=0.008..0.010 rows=1 loops=2476)
                                                                                Index Cond: (k.id = public.spotkania.klient)
127.803 0.24%
                                                                    -> Nested Loop (cost=147.54..6223.26 rows=2404 width=19) (actual time=15.655..127.803 rows=2477 loops=1)
92.457 0.17%
                                                                          -> Nested Loop (cost=147.54..5486.09 rows=2404 width=19) (actual time=15.639..92.457 rows=2477 loops=1)
51.665 0.10%
                                                                                -> Hash Join (cost=147.54..528.51 rows=2404 width=19) (actual time=15.600..51.665 rows=2477 loops=1)
                                                                                      Hash Cond: (sprz.id = s2s.aktywacja_id)
18.295 0.03%
                                                                                      -> Seq Scan on sprzedaz_aktywacja sprz (cost=0.0..286.33 rows=8069 width=15) (actual time=0.024..18.295 rows=8028 loops=1)
                                                                                            Filter: (umowa_zawarta_na IS NOT NULL)
15.546 0.03%
                                                                                      -> Hash (cost=83.35..83.35 rows=5135 width=16) (actual time=15.546..15.546 rows=2649 loops=1)
7.953 0.01%
                                                                                            -> Seq Scan on spotkania2sprzedaz s2s (cost=0.0..83.35 rows=5135 width=16) (actual time=0.013..7.953 rows=5135 loops=1)
24.770 0.05%
                                                                                -> Index Scan using spotkania_pkey on spotkania (cost=0.0..2.05 rows=1 width=16) (actual time=0.009..0.010 rows=1 loops=2477)
                                                                                      Index Cond: (public.spotkania.id = s2s.spotkanie_id)
19.816 0.04%
                                                                          -> Index Scan using klienci_pkey on klienci k (cost=0.0..0.29 rows=1 width=8) (actual time=0.006..0.008 rows=1 loops=2477)
                                                                                Index Cond: (k.id = public.spotkania.klient)
8.688 0.02%
                                                                    -> Subquery Scan "*SELECT* 4" (cost=0.0..48.36 rows=1918 width=12) (actual time=0.028..8.688 rows=1918 loops=1)
3.395 0.01%
                                                                          -> Seq Scan on klienci_konczace_umowy (cost=0.0..29.18 rows=1918 width=12) (actual time=0.023..3.395 rows=1918 loops=1)
3.800 0.01%
                                -> Index Scan using klienci_szczegoly_pkey on klienci_szczegoly (cost=0.0..8.27 rows=1 width=31) (actual time=0.014..0.019 rows=1 loops=200)
                                      Index Cond: (klienci.id = klienci_szczegoly.id)
44999.000 82.84%
                          -> Hash Join (cost=9837.13..10749.02 rows=1 width=8) (actual time=6.787..224.995 rows=31334 loops=200)
                                Hash Cond: ((s.klient = s.klient) AND ((max(s.czas_dodania)) = s.czas_dodania))
14948.800 27.52%
                                -> HashAggregate (cost=4342.83..4611.03 rows=21456 width=16) (actual time=4.290..74.744 rows=37169 loops=200)
612.677 1.13%
                                      -> Hash Join (cost=186.38..4226.7 rows=23227 width=16) (actual time=1.019..612.677 rows=114168 loops=1)
                                            Hash Cond: (s.od_kogo = p.id)
207.127 0.38%
                                            -> Seq Scan on spotkania s (cost=0.0..3282.22 rows=140222 width=20) (actual time=0.010..207.127 rows=140222 loops=1)
0.967 0.00%
                                            -> Hash (cost=186.04..186.04 rows=27 width=4) (actual time=0.967..0.967 rows=27 loops=1)
0.902 0.00%
                                                  -> Seq Scan on pracownicy p (cost=0.0..186.04 rows=27 width=4) (actual time=0.060..0.902 rows=27 loops=1)
                                                        Filter: (typ = 8::numeric)
497.543 0.92%
                                -> Hash (cost=3983.33..3983.33 rows=100731 width=16) (actual time=497.543..497.543 rows=120939 loops=1)
281.433 0.52%
                                      -> Seq Scan on spotkania s (cost=0.0..3983.33 rows=100731 width=16) (actual time=0.019..281.433 rows=120939 loops=1)
                                            Filter: ((rodzaj = 2::numeric) OR (rodzaj = 3::numeric))
5.000 0.01%
                    -> Index Scan using miasta_pkey on miasta (cost=0.0..8.27 rows=1 width=16) (actual time=0.023..0.025 rows=1 loops=200)
                          Index Cond: (klienci.miasto = miasta.id)
3.600 0.01%
              -> Index Scan using klienci_opiekuni_uniq on klienci_opiekuni ko2 (cost=0.0..8.27 rows=1 width=8) (actual time=0.018..0.018 rows=0 loops=200)
                    Index Cond: ((ko2.klient = klienci.id) AND (ko2.opiekun = 1))
2.400 0.00%
        -> Index Scan using klienci_opiekuni_uniq on klienci_opiekuni ko (cost=0.0..8.27 rows=1 width=4) (actual time=0.010..0.012 rows=1 loops=200)
              Index Cond: (ko.klient = klienci.id)