explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Hsto : Optimization for: plan #fLV

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.358 300.392 ↑ 44.3 41 1

Nested Loop Left Join (cost=24,690.05..1,227,669.23 rows=1,818 width=1,382) (actual time=188.827..300.392 rows=41 loops=1)

  • Output: "*SELECT* 1".artikl_sifra, "*SELECT* 1".is_pasiven, "*SELECT* 1".redoven, "*SELECT* 1".generikanaziv, "*SELECT* 1".artiklnaziv, "*SELECT* 1".komnaziv, "*SELECT* 1".kom_dobavuvac, ((((((COALESCE("*SELECT* 1".rok_godina, '0'::numeric))::text || '/'::text) || (COALESCE("*SELECT* 1".rok_mesec, '0'::numeric))::text) || ' - '::text) || (COALESCE("*SELECT* 1".serija, ''::character varying))::text)), (make_date((NULLIF("*SELECT* 1".rok_godina, '0'::numeric))::integer, CASE WHEN ("*SELECT* 1".rok_godina <> '0'::numeric) THEN LEAST(12, (GREATEST("*SELECT* 1".rok_mesec, '1'::numeric))::integer) ELSE (NULLIF(NULLIF("*SELECT* 1".rok_mesec, '0'::numeric), '99'::numeric))::integer END, 1)), (max("*SELECT* 1".prodazna)), (sum((((("*SELECT* 1".in_vl_iz)::numeric * "*SELECT* 1".kolicinavlez) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric))), (sum((((("*SELECT* 1".in_vl_iz)::numeric * ((0)::numeric)) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric))), (sum(((("*SELECT* 1".kolicinavlez - ((0)::numeric)) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric))), ((- sum((((((("*SELECT* 1".status <> 'Z'::"char"))::integer)::numeric * ("*SELECT* 1".kolicinavlez - ((0)::numeric))) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric)))), (sum(((((("*SELECT* 1".in_vl_iz)::numeric * "*SELECT* 1".nabavna) * "*SELECT* 1".kolicinavlez) / ("*SELECT* 1".parcinja)::numeric) * ("*SELECT* 1".faktor)::numeric))), (sum(((((("*SELECT* 1".in_vl_iz)::numeric * "*SELECT* 1".prodazna) * ((0)::numeric)) / ("*SELECT* 1".parcinja)::numeric) * ("*SELECT* 1".faktor)::numeric))), "*SELECT* 1".parcinja, "*SELECT* 1".asortiman_id, svc.nabavna, svc.prodazna, svc.maloprodazna, CASE WHEN (svc.nabavna = '0'::numeric) THEN '0'::numeric ELSE (((svc.prodazna - svc.nabavna) / svc.nabavna) * '100'::numeric) END, CASE WHEN (svc.fakturna = '0'::numeric) THEN '0'::numeric ELSE (((svc.prodazna - svc.fakturna) / svc.fakturna) * '100'::numeric) END
  • Buffers: shared hit=84041
2. 8.677 184.660 ↑ 44.3 41 1

HashAggregate (cost=24,028.11..24,159.91 rows=1,818 width=1,380) (actual time=184.206..184.660 rows=41 loops=1)

  • Output: "*SELECT* 1".artikl_sifra, "*SELECT* 1".is_pasiven, "*SELECT* 1".redoven, "*SELECT* 1".generikanaziv, "*SELECT* 1".artiklnaziv, "*SELECT* 1".komnaziv, "*SELECT* 1".kom_dobavuvac, (((((COALESCE("*SELECT* 1".rok_godina, '0'::numeric))::text || '/'::text) || (COALESCE("*SELECT* 1".rok_mesec, '0'::numeric))::text) || ' - '::text) || (COALESCE("*SELECT* 1".serija, ''::character varying))::text), make_date((NULLIF("*SELECT* 1".rok_godina, '0'::numeric))::integer, CASE WHEN ("*SELECT* 1".rok_godina <> '0'::numeric) THEN LEAST(12, (GREATEST("*SELECT* 1".rok_mesec, '1'::numeric))::integer) ELSE (NULLIF(NULLIF("*SELECT* 1".rok_mesec, '0'::numeric), '99'::numeric))::integer END, 1), max("*SELECT* 1".prodazna), sum((((("*SELECT* 1".in_vl_iz)::numeric * "*SELECT* 1".kolicinavlez) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric)), sum((((("*SELECT* 1".in_vl_iz)::numeric * ((0)::numeric)) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric)), sum(((("*SELECT* 1".kolicinavlez - ((0)::numeric)) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric)), (- sum((((((("*SELECT* 1".status <> 'Z'::"char"))::integer)::numeric * ("*SELECT* 1".kolicinavlez - ((0)::numeric))) * ("*SELECT* 1".faktor)::numeric) * ("*SELECT* 1".vlijae)::numeric))), sum(((((("*SELECT* 1".in_vl_iz)::numeric * "*SELECT* 1".nabavna) * "*SELECT* 1".kolicinavlez) / ("*SELECT* 1".parcinja)::numeric) * ("*SELECT* 1".faktor)::numeric)), sum(((((("*SELECT* 1".in_vl_iz)::numeric * "*SELECT* 1".prodazna) * ((0)::numeric)) / ("*SELECT* 1".parcinja)::numeric) * ("*SELECT* 1".faktor)::numeric)), "*SELECT* 1".parcinja, "*SELECT* 1".asortiman_id, "*SELECT* 1".rok_godina, "*SELECT* 1".rok_mesec, "*SELECT* 1".serija
  • Group Key: "*SELECT* 1".artikl_sifra, "*SELECT* 1".is_pasiven, "*SELECT* 1".redoven, "*SELECT* 1".parcinja, "*SELECT* 1".komnaziv, "*SELECT* 1".kom_dobavuvac, "*SELECT* 1".generikanaziv, "*SELECT* 1".artiklnaziv, "*SELECT* 1".asortiman_id, "*SELECT* 1".rok_godina, "*SELECT* 1".rok_mesec, "*SELECT* 1".serija
  • Buffers: shared hit=19336
3. 1.081 175.983 ↑ 7.6 1,192 1

Gather (cost=1,197.65..22,596.12 rows=9,092 width=1,247) (actual time=8.935..175.983 rows=1,192 loops=1)

  • Output: "*SELECT* 1".kolicinavlez, ((0)::numeric), "*SELECT* 1".nabavna, "*SELECT* 1".prodazna, "*SELECT* 1".faktor, "*SELECT* 1".artikl_sifra, "*SELECT* 1".redoven, "*SELECT* 1".datum_ddo, "*SELECT* 1".status, "*SELECT* 1".sta_vlez_id, "*SELECT* 1".parcinja, "*SELECT* 1".is_pasiven, "*SELECT* 1".artiklnaziv, "*SELECT* 1".komnaziv, "*SELECT* 1".kom_dobavuvac, "*SELECT* 1".generikanaziv, "*SELECT* 1".asortiman_id, "*SELECT* 1".rok_godina, "*SELECT* 1".rok_mesec, "*SELECT* 1".serija, "*SELECT* 1".vlijae, "*SELECT* 1".in_vl_iz
  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=19336
4. 0.000 174.902 ↑ 16.2 397 3

Parallel Append (cost=197.66..20,686.92 rows=6,440 width=1,247) (actual time=14.156..174.902 rows=397 loops=3)

  • Buffers: shared hit=19336
  • Worker 0: actual time=13.867..175.253 rows=336 loops=1
  • Buffers: shared hit=4786
  • Worker 1: actual time=21.205..175.553 rows=64 loops=1
  • Buffers: shared hit=3308
5. 0.077 85.931 ↑ 17.3 112 3

Subquery Scan on *SELECT* 1 (cost=197.76..5,180.03 rows=1,934 width=196) (actual time=32.159..85.931 rows=112 loops=3)

  • Output: "*SELECT* 1".kolicinavlez, 0, "*SELECT* 1".nabavna, "*SELECT* 1".prodazna, "*SELECT* 1".faktor, "*SELECT* 1".artikl_sifra, "*SELECT* 1".redoven, "*SELECT* 1".datum_ddo, "*SELECT* 1".status, "*SELECT* 1".sta_vlez_id, "*SELECT* 1".parcinja, "*SELECT* 1".is_pasiven, "*SELECT* 1".artiklnaziv, "*SELECT* 1".komnaziv, "*SELECT* 1".kom_dobavuvac, "*SELECT* 1".generikanaziv, "*SELECT* 1".asortiman_id, "*SELECT* 1".rok_godina, "*SELECT* 1".rok_mesec, "*SELECT* 1".serija, "*SELECT* 1".vlijae, "*SELECT* 1".in_vl_iz
  • Buffers: shared hit=5975
  • Worker 0: actual time=13.866..175.183 rows=336 loops=1
  • Buffers: shared hit=4786
  • Worker 1: actual time=41.421..41.421 rows=0 loops=1
  • Buffers: shared hit=531
6. 0.000 85.854 ↑ 10.2 112 3

Hash Left Join (cost=197.76..5,155.85 rows=1,138 width=168) (actual time=32.157..85.854 rows=112 loops=3)

  • Output: (sta_vlez.kolicina * (CASE tip_dokument.redoven WHEN 'F'::"char" THEN CASE WHEN (lekovi.izdava_parcinja > 0) THEN lekovi.pakovanje ELSE 1 END ELSE (artikli.parcinja)::integer END)::numeric), 0, sta_vlez.nabavna, sta_vlez.prodazna, sta_vlez.faktor, sta_vlez.artikl_sifra, tip_dokument.redoven, dok_vlez.datum_ddo, dok_vlez.status, sta_vlez.sta_vlez_id, CASE tip_dokument.redoven WHEN 'F'::"char" THEN COALESCE(NULLIF(lekovi.pakovanje, 0), 1) ELSE (artikli.parcinja)::integer END, (artikli.oznaka_k_r = 'P'::"char"), artikli.naziv, kom.naziv, kom_d.naziv, generici.naziv, artikli.asortiman_id, sta_vlez.rok_godina, sta_vlez.rok_mesec, sta_vlez.serija, sta_vlez.vlijae, ((dok_vlez.datum_ddo >= '2018-01-01'::date))::integer
  • Inner Unique: true
  • Hash Cond: (artikli.generika_id = generici.generika_id)
  • Buffers: shared hit=5975
  • Worker 0: actual time=13.864..174.953 rows=336 loops=1
  • Buffers: shared hit=4786
  • Worker 1: actual time=41.419..41.419 rows=0 loops=1
  • Buffers: shared hit=531
7. 0.183 85.331 ↑ 10.2 112 3

Hash Join (cost=159.10..5,082.90 rows=1,138 width=125) (actual time=31.850..85.331 rows=112 loops=3)

  • Output: sta_vlez.kolicina, sta_vlez.nabavna, sta_vlez.prodazna, sta_vlez.faktor, sta_vlez.artikl_sifra, sta_vlez.sta_vlez_id, sta_vlez.rok_godina, sta_vlez.rok_mesec, sta_vlez.serija, sta_vlez.vlijae, dok_vlez.datum_ddo, dok_vlez.status, tip_dokument.redoven, artikli.parcinja, artikli.oznaka_k_r, artikli.naziv, artikli.asortiman_id, artikli.generika_id, lekovi.izdava_parcinja, lekovi.pakovanje, kom.naziv, kom_d.naziv
  • Inner Unique: true
  • Hash Cond: ((dok_vlez.tip_dokument_id)::text = (tip_dokument.tip_dokument_id)::text)
  • Buffers: shared hit=5951
  • Worker 0: actual time=12.946..173.388 rows=336 loops=1
  • Buffers: shared hit=4762
  • Worker 1: actual time=41.418..41.418 rows=0 loops=1
  • Buffers: shared hit=531
8. 3.143 85.086 ↑ 15.4 112 3

Nested Loop (cost=156.43..5,075.48 rows=1,724 width=127) (actual time=31.705..85.086 rows=112 loops=3)

  • Output: sta_vlez.kolicina, sta_vlez.nabavna, sta_vlez.prodazna, sta_vlez.faktor, sta_vlez.artikl_sifra, sta_vlez.sta_vlez_id, sta_vlez.rok_godina, sta_vlez.rok_mesec, sta_vlez.serija, sta_vlez.vlijae, dok_vlez.datum_ddo, dok_vlez.status, dok_vlez.tip_dokument_id, artikli.parcinja, artikli.oznaka_k_r, artikli.naziv, artikli.asortiman_id, artikli.generika_id, lekovi.izdava_parcinja, lekovi.pakovanje, kom.naziv, kom_d.naziv
  • Inner Unique: true
  • Buffers: shared hit=5901
  • Worker 0: actual time=12.706..172.852 rows=337 loops=1
  • Buffers: shared hit=4714
  • Worker 1: actual time=41.276..41.276 rows=0 loops=1
  • Buffers: shared hit=530
9. 2.157 81.936 ↑ 14.6 391 3

Nested Loop (cost=156.14..3,199.99 rows=5,718 width=125) (actual time=10.213..81.936 rows=391 loops=3)

  • Output: sta_vlez.kolicina, sta_vlez.nabavna, sta_vlez.prodazna, sta_vlez.faktor, sta_vlez.artikl_sifra, sta_vlez.sta_vlez_id, sta_vlez.rok_godina, sta_vlez.rok_mesec, sta_vlez.serija, sta_vlez.vlijae, sta_vlez.dok_vlez_id, sta_vlez.interna_id, artikli.parcinja, artikli.oznaka_k_r, artikli.naziv, artikli.asortiman_id, artikli.generika_id, lekovi.izdava_parcinja, lekovi.pakovanje, kom.naziv, kom_d.naziv
  • Buffers: shared hit=2369
  • Worker 0: actual time=12.597..164.476 rows=996 loops=1
  • Buffers: shared hit=1720
  • Worker 1: actual time=9.252..40.700 rows=75 loops=1
  • Buffers: shared hit=302
10. 0.051 79.576 ↑ 32.7 11 3

Hash Left Join (cost=155.72..1,799.64 rows=360 width=82) (actual time=10.148..79.576 rows=11 loops=3)

  • Output: artikli.parcinja, artikli.oznaka_k_r, artikli.naziv, artikli.asortiman_id, artikli.sifra, artikli.generika_id, lekovi.izdava_parcinja, lekovi.pakovanje, kom.naziv, kom_d.naziv
  • Inner Unique: true
  • Hash Cond: ((artikli.komitent_sifra)::text = (kom_d.sifra)::text)
  • Buffers: shared hit=1338
  • Worker 0: actual time=12.537..158.044 rows=18 loops=1
  • Buffers: shared hit=795
  • Worker 1: actual time=9.215..40.390 rows=6 loops=1
  • Buffers: shared hit=258
11. 0.192 78.186 ↑ 32.7 11 3

Nested Loop Left Join (cost=78.00..1,720.98 rows=360 width=73) (actual time=8.777..78.186 rows=11 loops=3)

  • Output: artikli.parcinja, artikli.oznaka_k_r, artikli.naziv, artikli.asortiman_id, artikli.sifra, artikli.komitent_sifra, artikli.generika_id, lekovi.izdava_parcinja, lekovi.pakovanje, kom.naziv
  • Inner Unique: true
  • Buffers: shared hit=1236
  • Worker 0: actual time=11.352..156.821 rows=18 loops=1
  • Buffers: shared hit=761
  • Worker 1: actual time=7.686..38.850 rows=6 loops=1
  • Buffers: shared hit=224
12. 71.889 77.980 ↑ 32.7 11 3

Hash Left Join (cost=77.72..1,612.44 rows=360 width=69) (actual time=8.692..77.980 rows=11 loops=3)

  • Output: artikli.parcinja, artikli.oznaka_k_r, artikli.naziv, artikli.asortiman_id, artikli.sifra, artikli.fzo_sifra, artikli.komitent_sifra, artikli.generika_id, kom.naziv
  • Inner Unique: true
  • Hash Cond: ((artikli.proizvoditel_kom_sifra)::text = (kom.sifra)::text)
  • Filter: (((artikli.naziv)::text ~~* 'ceti%'::text) OR ((artikli.sifra)::text ~~* 'ceti%'::text) OR ((kom.naziv)::text ~~* 'ceti%'::text))
  • Rows Removed by Filter: 22052
  • Buffers: shared hit=1145
  • Worker 0: actual time=11.297..156.495 rows=18 loops=1
  • Buffers: shared hit=712
  • Worker 1: actual time=7.571..38.698 rows=6 loops=1
  • Buffers: shared hit=206
13. 4.789 4.789 ↑ 1.8 22,062 3

Parallel Seq Scan on public.artikli (cost=0.00..1,432.34 rows=38,934 width=60) (actual time=0.011..4.789 rows=22,062 loops=3)

  • Output: artikli.sifra, artikli.naziv, artikli.edinica_merka_id, artikli.tarifa_id, artikli.asortiman_id, artikli.proizvoditel_kom_sifra, artikli.komitent_sifra, artikli.orig_sifra, artikli.opis, artikli.oznaka_k_r, artikli.car_tarifa, artikli.generika_id, artikli.dejstvo_id, artikli.lek_id, artikli.fzo_sifra, artikli.merka, artikli.rok_traenje, artikli.pakuvanje, artikli.paleta, artikli.artikal, artikli.pozitivna_lista, artikli.parcinja, artikli.domasen, artikli.modified
  • Buffers: shared hit=1043
  • Worker 0: actual time=0.008..9.780 rows=43095 loops=1
  • Buffers: shared hit=678
  • Worker 1: actual time=0.006..2.369 rows=10888 loops=1
  • Buffers: shared hit=172
14. 0.636 1.302 ↑ 1.0 1,943 3

Hash (cost=53.43..53.43 rows=1,943 width=21) (actual time=1.302..1.302 rows=1,943 loops=3)

  • Output: kom.naziv, kom.sifra
  • Buckets: 2048 Batches: 1 Memory Usage: 120kB
  • Buffers: shared hit=102
  • Worker 0: actual time=1.335..1.335 rows=1943 loops=1
  • Buffers: shared hit=34
  • Worker 1: actual time=1.313..1.313 rows=1943 loops=1
  • Buffers: shared hit=34
15. 0.666 0.666 ↑ 1.0 1,943 3

Seq Scan on public.komitenti kom (cost=0.00..53.43 rows=1,943 width=21) (actual time=0.013..0.666 rows=1,943 loops=3)

  • Output: kom.naziv, kom.sifra
  • Buffers: shared hit=102
  • Worker 0: actual time=0.020..0.721 rows=1943 loops=1
  • Buffers: shared hit=34
  • Worker 1: actual time=0.011..0.602 rows=1943 loops=1
  • Buffers: shared hit=34
16. 0.014 0.014 ↑ 1.0 1 32

Index Scan using lekovi_pkey on public.lekovi (cost=0.28..0.30 rows=1 width=12) (actual time=0.014..0.014 rows=1 loops=32)

  • Output: lekovi.lek_id, lekovi.naziv, lekovi.oblik, lekovi.pakovanje, lekovi.izdava_pakovanje, lekovi.izdava_parcinja, lekovi.edinecna_tezina, lekovi.merka_1, lekovi.kolicina_1, lekovi.merka_2, lekovi.kolicina_2, lekovi.merka_3, lekovi.kolicina_3, lekovi.koncentracija, lekovi.merka_koncentrat, lekovi.proizvoditel, lekovi.atc, lekovi.pozitivna_lista, lekovi.cena, lekovi.vazi_od, lekovi.vazi_do, lekovi.rangiran, lekovi.nacin_izdavanje, lekovi.modified
  • Index Cond: (lekovi.lek_id = artikli.fzo_sifra)
  • Buffers: shared hit=91
  • Worker 0: actual time=0.013..0.013 rows=1 loops=18
  • Buffers: shared hit=49
  • Worker 1: actual time=0.021..0.021 rows=1 loops=6
  • Buffers: shared hit=18
17. 0.657 1.339 ↑ 1.0 1,943 3

Hash (cost=53.43..53.43 rows=1,943 width=21) (actual time=1.339..1.339 rows=1,943 loops=3)

  • Output: kom_d.naziv, kom_d.sifra
  • Buckets: 2048 Batches: 1 Memory Usage: 120kB
  • Buffers: shared hit=102
  • Worker 0: actual time=1.157..1.157 rows=1943 loops=1
  • Buffers: shared hit=34
  • Worker 1: actual time=1.492..1.492 rows=1943 loops=1
  • Buffers: shared hit=34
18. 0.682 0.682 ↑ 1.0 1,943 3

Seq Scan on public.komitenti kom_d (cost=0.00..53.43 rows=1,943 width=21) (actual time=0.034..0.682 rows=1,943 loops=3)

  • Output: kom_d.naziv, kom_d.sifra
  • Buffers: shared hit=102
  • Worker 0: actual time=0.009..0.498 rows=1943 loops=1
  • Buffers: shared hit=34
  • Worker 1: actual time=0.040..0.731 rows=1943 loops=1
  • Buffers: shared hit=34
19. 0.203 0.203 ↑ 1.5 37 32

Index Scan using sta_vlez_art_interna_index on public.sta_vlez (cost=0.43..3.33 rows=56 width=53) (actual time=0.032..0.203 rows=37 loops=32)

  • Output: sta_vlez.kolicina, sta_vlez.nabavna, sta_vlez.prodazna, sta_vlez.faktor, sta_vlez.artikl_sifra, sta_vlez.sta_vlez_id, sta_vlez.rok_godina, sta_vlez.rok_mesec, sta_vlez.serija, sta_vlez.vlijae, sta_vlez.dok_vlez_id, sta_vlez.interna_id
  • Index Cond: ((sta_vlez.artikl_sifra)::text = (artikli.sifra)::text)
  • Buffers: shared hit=1031
  • Worker 0: actual time=0.037..0.329 rows=55 loops=18
  • Buffers: shared hit=925
  • Worker 1: actual time=0.023..0.047 rows=12 loops=6
  • Buffers: shared hit=44
20. 0.007 0.007 ↓ 0.0 0 1,174

Index Scan using dok_vlez_pkey on public.dok_vlez (cost=0.29..0.33 rows=1 width=14) (actual time=0.007..0.007 rows=0 loops=1,174)

  • Output: dok_vlez.datum_ddo, dok_vlez.status, dok_vlez.dok_vlez_id, dok_vlez.interna_id, dok_vlez.tip_dokument_id
  • Index Cond: ((dok_vlez.dok_vlez_id = sta_vlez.dok_vlez_id) AND ((dok_vlez.interna_id)::text = (sta_vlez.interna_id)::text))
  • Filter: ((dok_vlez.datum_ddo <= '2018-11-19'::date) AND (date_part('YEAR'::text, (dok_vlez.datum_ddo)::timestamp without time zone) >= '2018'::double precision))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=3532
  • Worker 0: actual time=0.007..0.007 rows=0 loops=996
  • Buffers: shared hit=2994
  • Worker 1: actual time=0.007..0.007 rows=0 loops=75
  • Buffers: shared hit=228
21. 0.016 0.062 ↑ 1.0 52 3

Hash (cost=2.00..2.00 rows=53 width=4) (actual time=0.062..0.062 rows=52 loops=3)

  • Output: tip_dokument.redoven, tip_dokument.tip_dokument_id
  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=3
  • Worker 0: actual time=0.081..0.081 rows=52 loops=1
  • Buffers: shared hit=1
  • Worker 1: actual time=0.058..0.058 rows=52 loops=1
  • Buffers: shared hit=1
22. 0.046 0.046 ↑ 1.0 52 3

Seq Scan on public.tip_dokument (cost=0.00..2.00 rows=53 width=4) (actual time=0.021..0.046 rows=52 loops=3)

  • Output: tip_dokument.redoven, tip_dokument.tip_dokument_id
  • Filter: (tip_dokument.vlijae AND ((tip_dokument.tip_dokument_id)::text <> ALL ('{Z1,Z2,Z3}'::text[])))
  • Rows Removed by Filter: 21
  • Buffers: shared hit=3
  • Worker 0: actual time=0.026..0.061 rows=52 loops=1
  • Buffers: shared hit=1
  • Worker 1: actual time=0.022..0.042 rows=52 loops=1
  • Buffers: shared hit=1
23. 0.518 0.853 ↑ 1.0 1,274 1

Hash (cost=22.74..22.74 rows=1,274 width=22) (actual time=0.853..0.853 rows=1,274 loops=1)

  • Output: generici.naziv, generici.generika_id
  • Buckets: 2048 Batches: 1 Memory Usage: 86kB
  • Buffers: shared hit=10
  • Worker 0: actual time=0.853..0.853 rows=1274 loops=1
  • Buffers: shared hit=10
24. 0.335 0.335 ↑ 1.0 1,274 1

Seq Scan on public.generici (cost=0.00..22.74 rows=1,274 width=22) (actual time=0.030..0.335 rows=1,274 loops=1)

  • Output: generici.naziv, generici.generika_id
  • Buffers: shared hit=10
  • Worker 0: actual time=0.030..0.335 rows=1274 loops=1
  • Buffers: shared hit=10
25. 0.204 133.355 ↑ 16.7 428 2

Subquery Scan on *SELECT* 2 (cost=197.66..15,474.69 rows=7,158 width=166) (actual time=14.299..133.355 rows=428 loops=2)

  • Output: 0, "*SELECT* 2".kolicinaizlez, "*SELECT* 2".nabavna, "*SELECT* 2".prodazna, "*SELECT* 2".faktor, "*SELECT* 2".artikl_sifra, "*SELECT* 2".redoven, "*SELECT* 2".datum_ddo, "*SELECT* 2".status, "*SELECT* 2".sta_izlez_id, "*SELECT* 2".parcinja, "*SELECT* 2".is_pasiven, "*SELECT* 2".artiklnaziv, "*SELECT* 2".komnaziv, "*SELECT* 2".kom_dobavuvac, "*SELECT* 2".generikanaziv, "*SELECT* 2".asortiman_id, "*SELECT* 2".rok_godina, "*SELECT* 2".rok_mesec, "*SELECT* 2".serija, "*SELECT* 2".vlijae, "*SELECT* 2".in_vl_iz
  • Buffers: shared hit=13361
  • Worker 1: actual time=21.204..134.115 rows=64 loops=1
  • Buffers: shared hit=2777
26. 0.335 133.151 ↑ 9.8 428 2

Hash Left Join (cost=197.66..15,367.32 rows=4,211 width=136) (actual time=14.296..133.151 rows=428 loops=2)

  • Output: 0, sta_izlez.kolicina, sta_izlez.nabavna, sta_izlez.prodazna, sta_izlez.faktor, sta_izlez.artikl_sifra, tip_dokument_1.redoven, dok_izlez.datum_ddo, dok_izlez.status, sta_izlez.sta_izlez_id, CASE tip_dokument_1.redoven WHEN 'F'::"char" THEN COALESCE(NULLIF(lekovi_1.izdava_parcinja, 0), 1) ELSE (artikli_1.parcinja)::integer END, (artikli_1.oznaka_k_r = 'P'::"char"), artikli_1.naziv, kom_1.naziv, kom_d_1.naziv, generici_1.naziv, artikli_1.asortiman_id, sta_izlez.rok_godina, sta_izlez.rok_mesec, sta_izlez.serija, sta_izlez.vlijae, ((dok_izlez.datum_ddo >= '2018-01-01'::date))::integer
  • Inner Unique: true
  • Hash Cond: (artikli_1.generika_id = generici_1.generika_id)
  • Buffers: shared hit=13361
  • Worker 1: actual time=21.202..134.079 rows=64 loops=1
  • Buffers: shared hit=2777
27. 0.327 132.120 ↑ 9.8 428 2

Hash Join (cost=158.99..15,254.44 rows=4,211 width=116) (actual time=13.556..132.120 rows=428 loops=2)

  • Output: sta_izlez.kolicina, sta_izlez.nabavna, sta_izlez.prodazna, sta_izlez.faktor, sta_izlez.artikl_sifra, sta_izlez.sta_izlez_id, sta_izlez.rok_godina, sta_izlez.rok_mesec, sta_izlez.serija, sta_izlez.vlijae, dok_izlez.datum_ddo, dok_izlez.status, tip_dokument_1.redoven, artikli_1.parcinja, artikli_1.oznaka_k_r, artikli_1.naziv, artikli_1.asortiman_id, artikli_1.generika_id, lekovi_1.izdava_parcinja, kom_1.naziv, kom_d_1.naziv
  • Inner Unique: true
  • Hash Cond: ((dok_izlez.tip_dokument_id)::text = (tip_dokument_1.tip_dokument_id)::text)
  • Buffers: shared hit=13327
  • Worker 1: actual time=20.356..133.191 rows=64 loops=1
  • Buffers: shared hit=2753
28. 8.627 131.747 ↑ 13.1 428 2

Nested Loop (cost=156.57..15,236.49 rows=5,589 width=118) (actual time=13.435..131.747 rows=428 loops=2)

  • Output: sta_izlez.kolicina, sta_izlez.nabavna, sta_izlez.prodazna, sta_izlez.faktor, sta_izlez.artikl_sifra, sta_izlez.sta_izlez_id, sta_izlez.rok_godina, sta_izlez.rok_mesec, sta_izlez.serija, sta_izlez.vlijae, dok_izlez.datum_ddo, dok_izlez.status, dok_izlez.tip_dokument_id, artikli_1.parcinja, artikli_1.oznaka_k_r, artikli_1.naziv, artikli_1.asortiman_id, artikli_1.generika_id, lekovi_1.izdava_parcinja, kom_1.naziv, kom_d_1.naziv
  • Inner Unique: true
  • Buffers: shared hit=13278
  • Worker 1: actual time=20.161..132.955 rows=64 loops=1
  • Buffers: shared hit=2705
29. 5.067 123.114 ↑ 13.1 1,288 2

Nested Loop (cost=156.15..6,727.22 rows=16,866 width=116) (actual time=13.352..123.114 rows=1,288 loops=2)

  • Output: sta_izlez.kolicina, sta_izlez.nabavna, sta_izlez.prodazna, sta_izlez.faktor, sta_izlez.artikl_sifra, sta_izlez.sta_izlez_id, sta_izlez.rok_godina, sta_izlez.rok_mesec, sta_izlez.serija, sta_izlez.vlijae, sta_izlez.dok_izlez_id, sta_izlez.interna_id, artikli_1.parcinja, artikli_1.oznaka_k_r, artikli_1.naziv, artikli_1.asortiman_id, artikli_1.generika_id, lekovi_1.izdava_parcinja, kom_1.naziv, kom_d_1.naziv
  • Buffers: shared hit=2957
  • Worker 1: actual time=20.051..127.907 rows=445 loops=1
  • Buffers: shared hit=919
30. 0.039 117.736 ↑ 22.5 16 2

Hash Left Join (cost=155.72..1,799.64 rows=360 width=78) (actual time=13.304..117.736 rows=16 loops=2)

  • Output: artikli_1.parcinja, artikli_1.oznaka_k_r, artikli_1.naziv, artikli_1.asortiman_id, artikli_1.sifra, artikli_1.generika_id, lekovi_1.izdava_parcinja, kom_1.naziv, kom_d_1.naziv
  • Inner Unique: true
  • Hash Cond: ((artikli_1.komitent_sifra)::text = (kom_d_1.sifra)::text)
  • Buffers: shared hit=1270
  • Worker 1: actual time=19.983..125.452 rows=16 loops=1
  • Buffers: shared hit=662
31. 0.165 116.720 ↑ 22.5 16 2

Nested Loop Left Join (cost=78.00..1,720.98 rows=360 width=69) (actual time=12.308..116.720 rows=16 loops=2)

  • Output: artikli_1.parcinja, artikli_1.oznaka_k_r, artikli_1.naziv, artikli_1.asortiman_id, artikli_1.sifra, artikli_1.komitent_sifra, artikli_1.generika_id, lekovi_1.izdava_parcinja, kom_1.naziv
  • Inner Unique: true
  • Buffers: shared hit=1202
  • Worker 1: actual time=18.935..124.388 rows=16 loops=1
  • Buffers: shared hit=628
32. 108.522 116.548 ↑ 22.5 16 2

Hash Left Join (cost=77.72..1,612.44 rows=360 width=69) (actual time=12.276..116.548 rows=16 loops=2)

  • Output: artikli_1.parcinja, artikli_1.oznaka_k_r, artikli_1.naziv, artikli_1.asortiman_id, artikli_1.sifra, artikli_1.fzo_sifra, artikli_1.komitent_sifra, artikli_1.generika_id, kom_1.naziv
  • Inner Unique: true
  • Hash Cond: ((artikli_1.proizvoditel_kom_sifra)::text = (kom_1.sifra)::text)
  • Filter: (((artikli_1.naziv)::text ~~* 'ceti%'::text) OR ((artikli_1.sifra)::text ~~* 'ceti%'::text) OR ((kom_1.naziv)::text ~~* 'ceti%'::text))
  • Rows Removed by Filter: 33078
  • Buffers: shared hit=1111
  • Worker 1: actual time=18.888..124.200 rows=16 loops=1
  • Buffers: shared hit=579
33. 7.019 7.019 ↑ 1.2 33,094 2

Parallel Seq Scan on public.artikli artikli_1 (cost=0.00..1,432.34 rows=38,934 width=60) (actual time=0.005..7.019 rows=33,094 loops=2)

  • Output: artikli_1.sifra, artikli_1.naziv, artikli_1.edinica_merka_id, artikli_1.tarifa_id, artikli_1.asortiman_id, artikli_1.proizvoditel_kom_sifra, artikli_1.komitent_sifra, artikli_1.orig_sifra, artikli_1.opis, artikli_1.oznaka_k_r, artikli_1.car_tarifa, artikli_1.generika_id, artikli_1.dejstvo_id, artikli_1.lek_id, artikli_1.fzo_sifra, artikli_1.merka, artikli_1.rok_traenje, artikli_1.pakuvanje, artikli_1.paleta, artikli_1.artikal, artikli_1.pozitivna_lista, artikli_1.parcinja, artikli_1.domasen, artikli_1.modified
  • Buffers: shared hit=1043
  • Worker 1: actual time=0.004..8.219 rows=34520 loops=1
  • Buffers: shared hit=545
34. 0.522 1.007 ↑ 1.0 1,943 2

Hash (cost=53.43..53.43 rows=1,943 width=21) (actual time=1.007..1.007 rows=1,943 loops=2)

  • Output: kom_1.naziv, kom_1.sifra
  • Buckets: 2048 Batches: 1 Memory Usage: 120kB
  • Buffers: shared hit=68
  • Worker 1: actual time=1.107..1.107 rows=1943 loops=1
  • Buffers: shared hit=34
35. 0.485 0.485 ↑ 1.0 1,943 2

Seq Scan on public.komitenti kom_1 (cost=0.00..53.43 rows=1,943 width=21) (actual time=0.013..0.485 rows=1,943 loops=2)

  • Output: kom_1.naziv, kom_1.sifra
  • Buffers: shared hit=68
  • Worker 1: actual time=0.019..0.537 rows=1943 loops=1
  • Buffers: shared hit=34
36. 0.007 0.007 ↑ 1.0 1 32

Index Scan using lekovi_pkey on public.lekovi lekovi_1 (cost=0.28..0.30 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=32)

  • Output: lekovi_1.lek_id, lekovi_1.naziv, lekovi_1.oblik, lekovi_1.pakovanje, lekovi_1.izdava_pakovanje, lekovi_1.izdava_parcinja, lekovi_1.edinecna_tezina, lekovi_1.merka_1, lekovi_1.kolicina_1, lekovi_1.merka_2, lekovi_1.kolicina_2, lekovi_1.merka_3, lekovi_1.kolicina_3, lekovi_1.koncentracija, lekovi_1.merka_koncentrat, lekovi_1.proizvoditel, lekovi_1.atc, lekovi_1.pozitivna_lista, lekovi_1.cena, lekovi_1.vazi_od, lekovi_1.vazi_do, lekovi_1.rangiran, lekovi_1.nacin_izdavanje, lekovi_1.modified
  • Index Cond: (lekovi_1.lek_id = artikli_1.fzo_sifra)
  • Buffers: shared hit=91
  • Worker 1: actual time=0.009..0.009 rows=1 loops=16
  • Buffers: shared hit=49
37. 0.528 0.977 ↑ 1.0 1,943 2

Hash (cost=53.43..53.43 rows=1,943 width=21) (actual time=0.977..0.977 rows=1,943 loops=2)

  • Output: kom_d_1.naziv, kom_d_1.sifra
  • Buckets: 2048 Batches: 1 Memory Usage: 120kB
  • Buffers: shared hit=68
  • Worker 1: actual time=1.018..1.018 rows=1943 loops=1
  • Buffers: shared hit=34
38. 0.449 0.449 ↑ 1.0 1,943 2

Seq Scan on public.komitenti kom_d_1 (cost=0.00..53.43 rows=1,943 width=21) (actual time=0.008..0.449 rows=1,943 loops=2)

  • Output: kom_d_1.naziv, kom_d_1.sifra
  • Buffers: shared hit=68
  • Worker 1: actual time=0.008..0.448 rows=1943 loops=1
  • Buffers: shared hit=34
39. 0.311 0.311 ↑ 4.2 81 32

Index Scan using sta_izlez_artikal_interna_index on public.sta_izlez (cost=0.43..10.28 rows=341 width=48) (actual time=0.024..0.311 rows=81 loops=32)

  • Output: sta_izlez.kolicina, sta_izlez.nabavna, sta_izlez.prodazna, sta_izlez.faktor, sta_izlez.artikl_sifra, sta_izlez.sta_izlez_id, sta_izlez.rok_godina, sta_izlez.rok_mesec, sta_izlez.serija, sta_izlez.vlijae, sta_izlez.dok_izlez_id, sta_izlez.interna_id
  • Index Cond: ((sta_izlez.artikl_sifra)::text = (artikli_1.sifra)::text)
  • Buffers: shared hit=1687
  • Worker 1: actual time=0.030..0.140 rows=28 loops=16
  • Buffers: shared hit=257
40. 0.006 0.006 ↓ 0.0 0 2,577

Index Scan using dok_izlez_pkey on public.dok_izlez (cost=0.43..0.50 rows=1 width=14) (actual time=0.006..0.006 rows=0 loops=2,577)

  • Output: dok_izlez.datum_ddo, dok_izlez.status, dok_izlez.dok_izlez_id, dok_izlez.interna_id, dok_izlez.tip_dokument_id
  • Index Cond: ((dok_izlez.dok_izlez_id = sta_izlez.dok_izlez_id) AND ((dok_izlez.interna_id)::text = (sta_izlez.interna_id)::text))
  • Filter: ((dok_izlez.datum_ddo <= '2018-11-19'::date) AND (date_part('YEAR'::text, (dok_izlez.datum_ddo)::timestamp without time zone) >= '2018'::double precision))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=10321
  • Worker 1: actual time=0.011..0.011 rows=0 loops=445
  • Buffers: shared hit=1786
41. 0.015 0.046 ↑ 1.0 55 2

Hash (cost=1.73..1.73 rows=55 width=4) (actual time=0.046..0.046 rows=55 loops=2)

  • Output: tip_dokument_1.redoven, tip_dokument_1.tip_dokument_id
  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=2
  • Worker 1: actual time=0.053..0.053 rows=55 loops=1
  • Buffers: shared hit=1
42. 0.031 0.031 ↑ 1.0 55 2

Seq Scan on public.tip_dokument tip_dokument_1 (cost=0.00..1.73 rows=55 width=4) (actual time=0.014..0.031 rows=55 loops=2)

  • Output: tip_dokument_1.redoven, tip_dokument_1.tip_dokument_id
  • Filter: tip_dokument_1.vlijae
  • Rows Removed by Filter: 18
  • Buffers: shared hit=2
  • Worker 1: actual time=0.017..0.036 rows=55 loops=1
  • Buffers: shared hit=1
43. 0.396 0.696 ↑ 1.0 1,274 2

Hash (cost=22.74..22.74 rows=1,274 width=22) (actual time=0.696..0.696 rows=1,274 loops=2)

  • Output: generici_1.naziv, generici_1.generika_id
  • Buckets: 2048 Batches: 1 Memory Usage: 86kB
  • Buffers: shared hit=20
  • Worker 1: actual time=0.768..0.768 rows=1274 loops=1
  • Buffers: shared hit=10
44. 0.300 0.300 ↑ 1.0 1,274 2

Seq Scan on public.generici generici_1 (cost=0.00..22.74 rows=1,274 width=22) (actual time=0.020..0.300 rows=1,274 loops=2)

  • Output: generici_1.naziv, generici_1.generika_id
  • Buffers: shared hit=20
  • Worker 1: actual time=0.030..0.290 rows=1274 loops=1
  • Buffers: shared hit=10
45. 0.082 115.374 ↑ 1.0 1 41

Subquery Scan on svc (cost=661.94..661.96 rows=1 width=34) (actual time=2.811..2.814 rows=1 loops=41)

  • Output: svc.fakturna, svc.nabavna, svc.prodazna, svc.maloprodazna, svc.artikl_sifra, dok_vlez_1.datum_ddo, tip_dokument_2.pozitiven, sta_vlez_1.modified
  • Filter: (("*SELECT* 1".artikl_sifra)::text = (svc.artikl_sifra)::text)
  • Buffers: shared hit=64705
46. 0.205 115.292 ↑ 1.0 1 41

Limit (cost=661.94..661.94 rows=1 width=47) (actual time=2.809..2.812 rows=1 loops=41)

  • Output: sta_vlez_1.fakturna, sta_vlez_1.nabavna, sta_vlez_1.prodazna, sta_vlez_1.maloprodazna, sta_vlez_1.artikl_sifra, dok_vlez_1.datum_ddo, tip_dokument_2.pozitiven, sta_vlez_1.modified
  • Buffers: shared hit=64705
47. 3.813 115.087 ↑ 8.0 1 41

Sort (cost=661.94..661.96 rows=8 width=47) (actual time=2.807..2.807 rows=1 loops=41)

  • Output: sta_vlez_1.fakturna, sta_vlez_1.nabavna, sta_vlez_1.prodazna, sta_vlez_1.maloprodazna, sta_vlez_1.artikl_sifra, dok_vlez_1.datum_ddo, tip_dokument_2.pozitiven, sta_vlez_1.modified
  • Sort Key: dok_vlez_1.datum_ddo DESC, tip_dokument_2.pozitiven DESC, sta_vlez_1.modified DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=64705
48. 5.166 111.274 ↓ 22.5 180 41

Hash Join (cost=7.23..661.90 rows=8 width=47) (actual time=0.159..2.714 rows=180 loops=41)

  • Output: sta_vlez_1.fakturna, sta_vlez_1.nabavna, sta_vlez_1.prodazna, sta_vlez_1.maloprodazna, sta_vlez_1.artikl_sifra, dok_vlez_1.datum_ddo, tip_dokument_2.pozitiven, sta_vlez_1.modified
  • Inner Unique: true
  • Hash Cond: ((dok_vlez_1.tip_dokument_id)::text = (tip_dokument_2.tip_dokument_id)::text)
  • Buffers: shared hit=64705
49. 4.575 104.919 ↓ 7.8 397 41

Nested Loop (cost=5.15..659.68 rows=51 width=49) (actual time=0.120..2.559 rows=397 loops=41)

  • Output: sta_vlez_1.fakturna, sta_vlez_1.nabavna, sta_vlez_1.prodazna, sta_vlez_1.maloprodazna, sta_vlez_1.artikl_sifra, sta_vlez_1.modified, dok_vlez_1.datum_ddo, dok_vlez_1.tip_dokument_id
  • Inner Unique: true
  • Buffers: shared hit=64664
50. 32.800 35.260 ↓ 7.1 397 41

Bitmap Heap Scan on public.sta_vlez sta_vlez_1 (cost=4.86..222.04 rows=56 width=48) (actual time=0.109..0.860 rows=397 loops=41)

  • Output: sta_vlez_1.fakturna, sta_vlez_1.nabavna, sta_vlez_1.prodazna, sta_vlez_1.maloprodazna, sta_vlez_1.artikl_sifra, sta_vlez_1.modified, sta_vlez_1.dok_vlez_id, sta_vlez_1.interna_id
  • Recheck Cond: ((sta_vlez_1.artikl_sifra)::text = ("*SELECT* 1".artikl_sifra)::text)
  • Heap Blocks: exact=15686
  • Buffers: shared hit=15851
51. 2.460 2.460 ↓ 7.1 397 41

Bitmap Index Scan on sta_vlez_art_serija_vlijae_index (cost=0.00..4.85 rows=56 width=0) (actual time=0.060..0.060 rows=397 loops=41)

  • Index Cond: ((sta_vlez_1.artikl_sifra)::text = ("*SELECT* 1".artikl_sifra)::text)
  • Buffers: shared hit=165
52. 65.084 65.084 ↑ 1.0 1 16,271

Index Scan using dok_vlez_pkey on public.dok_vlez dok_vlez_1 (cost=0.29..7.81 rows=1 width=13) (actual time=0.004..0.004 rows=1 loops=16,271)

  • Output: dok_vlez_1.datum_ddo, dok_vlez_1.dok_vlez_id, dok_vlez_1.interna_id, dok_vlez_1.tip_dokument_id
  • Index Cond: ((dok_vlez_1.dok_vlez_id = sta_vlez_1.dok_vlez_id) AND ((dok_vlez_1.interna_id)::text = (sta_vlez_1.interna_id)::text))
  • Filter: (dok_vlez_1.datum_ddo <= now())
  • Buffers: shared hit=48813
53. 0.410 1.189 ↑ 1.0 13 41

Hash (cost=1.91..1.91 rows=13 width=4) (actual time=0.029..0.029 rows=13 loops=41)

  • Output: tip_dokument_2.pozitiven, tip_dokument_2.tip_dokument_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=41
54. 0.779 0.779 ↑ 1.0 13 41

Seq Scan on public.tip_dokument tip_dokument_2 (cost=0.00..1.91 rows=13 width=4) (actual time=0.009..0.019 rows=13 loops=41)

  • Output: tip_dokument_2.pozitiven, tip_dokument_2.tip_dokument_id
  • Filter: (tip_dokument_2.vlijae_cena AND (tip_dokument_2.redoven = "*SELECT* 1".redoven))
  • Rows Removed by Filter: 60
  • Buffers: shared hit=41