=# explain depesz.com;

Exclusive Inclusive Rows x Node
0.0
Nested Loop (cost=13092.70..13118.61 rows=5 width=610) (actual time=.. rows= loops=)
  • Join Filter: ((("outer".contpartener)::character varying(255))::text ~~ (("inner".conts)::text || '%'::text))
0.0
->Hash Left Join (cost=11823.68..11824.01 rows=4 width=571) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".moneda)::text = ("inner".valuta)::text)
0.0
->Subquery Scan history_decontari1 (cost=11821.53..11821.83 rows=4 width=560) (actual time=.. rows= loops=)
0.0
->Unique (cost=11821.53..11821.79 rows=4 width=759) (actual time=.. rows= loops=)
0.0
->Sort (cost=11821.53..11821.54 rows=4 width=759) (actual time=.. rows= loops=)
  • Sort Key: tip, datdoc, tipdoc, nrdoc, expl, contpartener, valoare, totdecontat, restant, valoareref, totdecontatref, restantref, lastdecont, scadenta, contcoresp, agent, extrainfo, centru, unit, moneda, curs, restantmon, docdec, part_ref, part_pl
0.0
->Append (cost=6030.50..11821.49 rows=4 width=759) (actual time=.. rows= loops=)
0.0
->Subquery Scan "*SELECT* 1" (cost=6030.50..6032.75 rows=1 width=179) (actual time=.. rows= loops=)
0.0
->Nested Loop Left Join (cost=6030.50..6032.74 rows=1 width=179) (actual time=.. rows= loops=)
  • Join Filter: (("outer".docdec)::text = ("inner".nrdoc)::text)
  • Filter: (("inner".tipdoc)::text IS NULL)
InitPlan ( for Nested Loop Left Join )
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=7) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=8) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=4) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash Join (cost=3067.26..3069.26 rows=1 width=179) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".username)::text = ("inner".username)::text)
0.0
->Hash Join (cost=3066.16..3068.13 rows=4 width=189) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".centruid)::text = ("inner".centru)::text)
0.0
->Seq Scan on user_centre  (cost=0.00..1.62 rows=62 width=20) (actual time=.. rows= loops=)
0.0
->Hash (cost=3066.16..3066.16 rows=1 width=179) (actual time=.. rows= loops=)
0.0
->Seq Scan on notecont  (cost=0.00..3066.16 rows=1 width=179) (actual time=.. rows= loops=)
  • Filter: (((CASE WHEN ((($18)::text = 'd'::text) = true) THEN concr ELSE condb END)::text ~~ ($19)::text) AND (datdoc <= $20) AND ((condb)::text !~~ '409%'::text) AND ((concr)::text !~~ '419%'::text) AND ((centru)::text ~~ ($21)::text))
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Subquery Scan history_docs (cost=2956.70..2956.89 rows=3 width=64) (actual time=.. rows= loops=)
0.0
->Unique (cost=2956.70..2956.86 rows=3 width=853) (actual time=.. rows= loops=)
0.0
->Sort (cost=2956.70..2956.71 rows=3 width=853) (actual time=.. rows= loops=)
  • Sort Key: tip, datdoc, tipdoc, nrdoc, expl, contpartener, valoare, a_decontat, valoareref, a_decontatref, scadenta, agent, contcoresp, extrainfo, centru, unit, moneda, curs, part_ref, part_pl
0.0
->Append (cost=113.95..2956.68 rows=3 width=853) (actual time=.. rows= loops=)
0.0
->Subquery Scan "*SELECT* 1" (cost=113.95..116.00 rows=2 width=478) (actual time=.. rows= loops=)
0.0
->Nested Loop Left Join (cost=113.95..115.98 rows=2 width=478) (actual time=.. rows= loops=)
  • Join Filter: ((("outer".tipdoc)::text = ("inner".tipd)::text) AND (("outer".nrdoc)::text = ("inner".nrd)::text))
InitPlan ( for Nested Loop Left Join )
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=7) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=4) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash Join (cost=110.68..112.68 rows=2 width=192) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".username)::text = ("inner".username)::text)
0.0
->Hash Join (cost=109.59..111.56 rows=4 width=202) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".centruid)::text = ("inner".centru)::text)
0.0
->Seq Scan on user_centre  (cost=0.00..1.62 rows=62 width=20) (actual time=.. rows= loops=)
0.0
->Hash (cost=109.59..109.59 rows=1 width=192) (actual time=.. rows= loops=)
0.0
->Seq Scan on arh_history  (cost=0.00..109.59 rows=1 width=192) (actual time=.. rows= loops=)
  • Filter: (((contpartener)::text ~~ ($30)::text) AND ((tip)::text = (CASE WHEN ((($31)::text = 'd'::text) = true) THEN 'v'::character varying ELSE 'c'::character varying END)::text) AND ((centru)::text ~~ ($32)::text))
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on arh_docs_info  (cost=0.00..0.00 rows=1 width=572) (actual time=.. rows= loops=)
0.0
->Subquery Scan "*SELECT* 2" (cost=2834.91..2840.68 rows=1 width=853) (actual time=.. rows= loops=)
0.0
->Nested Loop Left Join (cost=2834.91..2840.67 rows=1 width=853) (actual time=.. rows= loops=)
0.0
->Subquery Scan i (cost=2834.91..2834.97 rows=1 width=702) (actual time=.. rows= loops=)
0.0
->HashAggregate (cost=2834.91..2834.96 rows=1 width=174) (actual time=.. rows= loops=)
InitPlan ( for HashAggregate )
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=7) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=8) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=4) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash Join (cost=2824.14..2826.15 rows=1 width=174) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".username)::text = ("inner".username)::text)
0.0
->Hash Join (cost=2823.04..2825.01 rows=4 width=184) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".centruid)::text = ("inner".centru)::text)
0.0
->Seq Scan on user_centre  (cost=0.00..1.62 rows=62 width=20) (actual time=.. rows= loops=)
0.0
->Hash (cost=2823.04..2823.04 rows=1 width=174) (actual time=.. rows= loops=)
0.0
->Seq Scan on notecont  (cost=0.00..2823.04 rows=1 width=174) (actual time=.. rows= loops=)
  • Filter: (((CASE WHEN ((($26)::text = 'd'::text) = true) THEN condb ELSE concr END)::text ~~ ($27)::text) AND (datdoc <= $28) AND ((centru)::text ~~ ($29)::text))
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Index Scan using doc on docs_info  (cost=0.00..5.68 rows=1 width=166) (actual time=.. rows= loops=)
  • Index Cond: ((("outer".tipdoc)::text = (docs_info.tipd)::text) AND (("outer".nrdoc)::text = (docs_info.nrd)::text))
0.0
->Subquery Scan "*SELECT* 2" (cost=5788.33..5788.74 rows=3 width=759) (actual time=.. rows= loops=)
0.0
->Hash Left Join (cost=5788.33..5788.71 rows=3 width=759) (actual time=.. rows= loops=)
  • Hash Cond: ((("outer".contpartener)::text = ("inner".contpartener)::text) AND (("outer".nrdoc)::text = ("inner".docdec)::text))
  • Filter: ((abs("outer".valoare) >= 0.01) OR (abs(COALESCE(("inner".decontat)::double precision, 0::double precision)) >= 0.01::double precision) OR (abs(COALESCE("outer".a_decontat, 0::double precision)) >= 0.01::double precision))
0.0
->Subquery Scan history_docs (cost=2956.70..2956.89 rows=3 width=544) (actual time=.. rows= loops=)
0.0
->Unique (cost=2956.70..2956.86 rows=3 width=853) (actual time=.. rows= loops=)
0.0
->Sort (cost=2956.70..2956.71 rows=3 width=853) (actual time=.. rows= loops=)
  • Sort Key: tip, datdoc, tipdoc, nrdoc, expl, contpartener, valoare, a_decontat, valoareref, a_decontatref, scadenta, agent, contcoresp, extrainfo, centru, unit, moneda, curs, part_ref, part_pl
0.0
->Append (cost=113.95..2956.68 rows=3 width=853) (actual time=.. rows= loops=)
0.0
->Subquery Scan "*SELECT* 1" (cost=113.95..116.00 rows=2 width=478) (actual time=.. rows= loops=)
0.0
->Nested Loop Left Join (cost=113.95..115.98 rows=2 width=478) (actual time=.. rows= loops=)
  • Join Filter: ((("outer".tipdoc)::text = ("inner".tipd)::text) AND (("outer".nrdoc)::text = ("inner".nrd)::text))
InitPlan ( for Nested Loop Left Join )
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=7) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=4) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash Join (cost=110.68..112.68 rows=2 width=192) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".username)::text = ("inner".username)::text)
0.0
->Hash Join (cost=109.59..111.56 rows=4 width=202) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".centruid)::text = ("inner".centru)::text)
0.0
->Seq Scan on user_centre  (cost=0.00..1.62 rows=62 width=20) (actual time=.. rows= loops=)
0.0
->Hash (cost=109.59..109.59 rows=1 width=192) (actual time=.. rows= loops=)
0.0
->Seq Scan on arh_history  (cost=0.00..109.59 rows=1 width=192) (actual time=.. rows= loops=)
  • Filter: (((contpartener)::text ~~ ($13)::text) AND ((tip)::text = (CASE WHEN ((($14)::text = 'd'::text) = true) THEN 'v'::character varying ELSE 'c'::character varying END)::text) AND ((centru)::text ~~ ($15)::text))
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on arh_docs_info  (cost=0.00..0.00 rows=1 width=572) (actual time=.. rows= loops=)
0.0
->Subquery Scan "*SELECT* 2" (cost=2834.91..2840.68 rows=1 width=853) (actual time=.. rows= loops=)
0.0
->Nested Loop Left Join (cost=2834.91..2840.67 rows=1 width=853) (actual time=.. rows= loops=)
0.0
->Subquery Scan i (cost=2834.91..2834.97 rows=1 width=702) (actual time=.. rows= loops=)
0.0
->HashAggregate (cost=2834.91..2834.96 rows=1 width=174) (actual time=.. rows= loops=)
InitPlan ( for HashAggregate )
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=7) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=8) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=4) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash Join (cost=2824.14..2826.15 rows=1 width=174) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".username)::text = ("inner".username)::text)
0.0
->Hash Join (cost=2823.04..2825.01 rows=4 width=184) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".centruid)::text = ("inner".centru)::text)
0.0
->Seq Scan on user_centre  (cost=0.00..1.62 rows=62 width=20) (actual time=.. rows= loops=)
0.0
->Hash (cost=2823.04..2823.04 rows=1 width=174) (actual time=.. rows= loops=)
0.0
->Seq Scan on notecont  (cost=0.00..2823.04 rows=1 width=174) (actual time=.. rows= loops=)
  • Filter: (((CASE WHEN ((($9)::text = 'd'::text) = true) THEN condb ELSE concr END)::text ~~ ($10)::text) AND (datdoc <= $11) AND ((centru)::text ~~ ($12)::text))
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Index Scan using doc on docs_info  (cost=0.00..5.68 rows=1 width=166) (actual time=.. rows= loops=)
  • Index Cond: ((("outer".tipdoc)::text = (docs_info.tipd)::text) AND (("outer".nrdoc)::text = (docs_info.nrd)::text))
0.0
->Hash (cost=2831.63..2831.63 rows=1 width=247) (actual time=.. rows= loops=)
0.0
->Subquery Scan history_decs (cost=2831.60..2831.63 rows=1 width=247) (actual time=.. rows= loops=)
0.0
->HashAggregate (cost=2831.60..2831.62 rows=1 width=70) (actual time=.. rows= loops=)
InitPlan ( for HashAggregate )
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=5) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=7) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=8) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=4) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash Join (cost=2824.14..2826.14 rows=1 width=70) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".username)::text = ("inner".username)::text)
0.0
->Hash Join (cost=2823.04..2825.01 rows=4 width=80) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".centruid)::text = ("inner".centru)::text)
0.0
->Seq Scan on user_centre  (cost=0.00..1.62 rows=62 width=20) (actual time=.. rows= loops=)
0.0
->Hash (cost=2823.04..2823.04 rows=1 width=81) (actual time=.. rows= loops=)
0.0
->Seq Scan on notecont  (cost=0.00..2823.04 rows=1 width=81) (actual time=.. rows= loops=)
  • Filter: (((CASE WHEN ((($1)::text = 'd'::text) = true) THEN concr ELSE condb END)::text ~~ ($2)::text) AND (datdoc <= $3) AND ((centru)::text ~~ ($4)::text))
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Hash (cost=2.15..2.15 rows=1 width=18) (actual time=.. rows= loops=)
0.0
->Hash Join (cost=1.09..2.15 rows=1 width=18) (actual time=.. rows= loops=)
  • Hash Cond: (("outer".userid)::text = ("inner".username)::text)
0.0
->Seq Scan on mymonede  (cost=0.00..1.03 rows=3 width=27) (actual time=.. rows= loops=)
0.0
->Hash (cost=1.09..1.09 rows=1 width=10) (actual time=.. rows= loops=)
0.0
->Seq Scan on myvars  (cost=0.00..1.09 rows=1 width=10) (actual time=.. rows= loops=)
  • Filter: (lower((username)::text) = lower((("current_user"())::character varying)::text))
0.0
->Materialize (cost=1269.02..1271.14 rows=212 width=46) (actual time=.. rows= loops=)
0.0
->Merge Left Join (cost=1257.07..1269.02 rows=212 width=46) (actual time=.. rows= loops=)
  • Merge Cond: (("outer".conts)::text = "inner"."?column2?")
  • Filter: ("inner"."?column2?" IS NULL)
0.0
->Index Scan using pkps on plancont_sint  (cost=0.00..8.24 rows=212 width=46) (actual time=.. rows= loops=)
0.0
->Sort (cost=1257.07..1257.60 rows=212 width=93) (actual time=.. rows= loops=)
  • Sort Key: (ps.conts)::text
0.0
->Subquery Scan ps (cost=1246.76..1248.88 rows=212 width=93) (actual time=.. rows= loops=)
0.0
->HashAggregate (cost=1246.76..1246.76 rows=212 width=7) (actual time=.. rows= loops=)
0.0
->Nested Loop (cost=5.12..1246.20 rows=224 width=7) (actual time=.. rows= loops=)
  • Join Filter: ((("outer".conts)::text ~~ (("inner".conts)::text || '%'::text)) AND (("outer".conts)::text <> ("inner".conts)::text))
0.0
->Seq Scan on plancont_sint  (cost=0.00..5.12 rows=212 width=7) (actual time=.. rows= loops=)
0.0
->Materialize (cost=5.12..7.24 rows=212 width=7) (actual time=.. rows= loops=)
0.0
->Seq Scan on plancont_sint ps (cost=0.00..5.12 rows=212 width=7) (actual time=.. rows= loops=)