suker1

Change label
Query Plan as raw text
Summary
Time Node
Node (ms) Percent
76825.264 100.00%
 GroupAggregate (cost=88955.71..1389798.66 rows=135312 width=117) (actual time=11841.101..76825.264 rows=65 loops=1)
  Filter: ((COALESCE(fngetpsaldobegtrade(tblclient.id, tblshare.id, ('now'::text)::date), 0::numeric) - COALESCE(sum(public.depolimits.openbal), 0::numeric)) <> 0::numeric)
  InitPlan
0.015 0.00%
    -> Limit (cost=0.0..0.02 rows=1 width=13) (actual time=0.015..0.015 rows=1 loops=1)
0.013 0.00%
          -> Seq Scan on depolimits (cost=0.0..110.58 rows=4758 width=13) (actual time=0.013..0.013 rows=1 loops=1)
6879.573 8.95%
  -> Merge Left Join (cost=88955.69..90368.51 rows=135312 width=117) (actual time=6017.652..6879.573 rows=6123 loops=1)
        Merge Cond: ((tbldepoaccount.iperson = public.depolimits.iclient) AND (tblshare.id = public.depolimits.ishare))
        Filter: ((public.depolimits.ishare = tbldeposaldo.ishare) OR ((public.depolimits.ishare IS NOT NULL) AND (tbldeposaldo.ishare IS NULL)) OR ((tbldeposaldo.ishare IS NOT NULL) AND (public.depolimits.ishare IS NULL)))
6516.220 8.48%
        -> Sort (cost=88554.49..89005.93 rows=180576 width=89) (actual time=5920.947..6516.220 rows=244728 loops=1)
              Sort Key: tblclient.id, tblshare.id
              Sort Method:  external merge  Disk: 25816kB
3058.816 3.98%
              -> Merge Right Join (cost=51732.57..54266.18 rows=180576 width=89) (actual time=2018.079..3058.816 rows=244728 loops=1)
                    Merge Cond: ((tbldeposaldo.ishare = tblshare.id) AND (tbldeposaldo.idepoaccount = tbldepoaccount.id))
617.511 0.80%
                    -> Unique (cost=14770.53..15723.17 rows=12702 width=8) (actual time=433.679..617.511 rows=9347 loops=1)
555.484 0.72%
                          -> Sort (cost=14770.53..15088.07 rows=127019 width=8) (actual time=433.676..555.484 rows=127019 loops=1)
                                Sort Key: tbldeposaldo.ishare, tbldeposaldo.idepoaccount
                                Sort Method:  external merge  Disk: 2960kB
143.697 0.19%
                                -> Seq Scan on tbldeposaldo (cost=0.0..2263.19 rows=127019 width=8) (actual time=0.032..143.697 rows=127019 loops=1)
2148.547 2.80%
                    -> Materialize (cost=36962.05..39219.25 rows=180576 width=85) (actual time=1584.386..2148.547 rows=244728 loops=1)
1928.456 2.51%
                          -> Sort (cost=36962.05..37413.49 rows=180576 width=85) (actual time=1584.379..1928.456 rows=244728 loops=1)
                                Sort Key: tblshare.id, tbldepoaccount.id
                                Sort Method:  external merge  Disk: 23936kB
333.296 0.43%
                                -> Nested Loop (cost=121.91..3912.73 rows=180576 width=85) (actual time=18.527..333.296 rows=244728 loops=1)
24.779 0.03%
                                      -> Hash Join (cost=85.2..264.5 rows=228 width=43) (actual time=18.481..24.779 rows=309 loops=1)
                                            Hash Cond: (tblclient.id = tbldepoaccount.iperson)
8.521 0.01%
                                            -> Hash Left Join (cost=56.95..229.08 rows=483 width=39) (actual time=2.888..8.521 rows=486 loops=1)
                                                  Hash Cond: (tblclient.id = tblexclicode.iclient)
7.019 0.01%
                                                  -> Hash Join (cost=34.77..199.31 rows=483 width=34) (actual time=2.075..7.019 rows=483 loops=1)
                                                        Hash Cond: (tblperson.id = tblclient.id)
2.290 0.00%
                                                        -> Seq Scan on tblperson (cost=0.0..145.88 rows=3688 width=30) (actual time=0.006..2.290 rows=3688 loops=1)
2.045 0.00%
                                                        -> Hash (cost=28.73..28.73 rows=483 width=4) (actual time=2.045..2.045 rows=483 loops=1)
1.693 0.00%
                                                              -> Seq Scan on tblclient (cost=0.0..28.73 rows=483 width=4) (actual time=0.026..1.693 rows=483 loops=1)
                                                                    Filter: ((dtclosed >= ('now'::text)::date) OR (dtclosed IS NULL))
0.800 0.00%
                                                  -> Hash (cost=16.15..16.15 rows=482 width=9) (actual time=0.800..0.800 rows=482 loops=1)
0.491 0.00%
                                                        -> Seq Scan on tblexclicode (cost=0.0..16.15 rows=482 width=9) (actual time=0.050..0.491 rows=482 loops=1)
                                                              Filter: (iplace = 2)
15.576 0.02%
                                            -> Hash (cost=23.03..23.03 rows=418 width=8) (actual time=15.576..15.576 rows=483 loops=1)
15.275 0.02%
                                                  -> Seq Scan on tbldepoaccount (cost=0.0..23.03 rows=418 width=8) (actual time=0.079..15.275 rows=483 loops=1)
                                                        Filter: ((iperson IS NOT NULL) AND (flgmanaged = 1) AND (iplace = 2))
110.622 0.14%
                                      -> Materialize (cost=36.71..44.63 rows=792 width=42) (actual time=0.001..0.358 rows=792 loops=309)
25.300 0.03%
                                            -> Seq Scan on tblshare (cost=0.0..35.92 rows=792 width=42) (actual time=0.037..25.300 rows=792 loops=1)
103.721 0.14%
        -> Sort (cost=401.2..413.1 rows=4758 width=40) (actual time=96.644..103.721 rows=4758 loops=1)
              Sort Key: public.depolimits.iclient, public.depolimits.ishare
              Sort Method:  quicksort  Memory: 463kB
86.020 0.11%
              -> Seq Scan on depolimits (cost=0.0..110.58 rows=4758 width=40) (actual time=0.080..86.020 rows=4758 loops=1)
  SubPlan
11.132 0.01%
    -> Limit (cost=0.0..8.75 rows=1 width=13) (actual time=0.506..0.506 rows=1 loops=22)
10.780 0.01%
          -> Seq Scan on depolimits (cost=0.0..122.47 rows=14 width=13) (actual time=0.490..0.490 rows=1 loops=22)
                Filter: (iclient = $0)
Run-time
1 minute 16.834768 seconds (76834.768 ms)