Explain for select * from vtb_allocactpay

Seq Scan: 13
Index Scan: 23
SubPlan: 5
Nested Loop: 14

NOTICE: QUERY PLAN:
Subquery Scan vtb_allocactpay (cost=26898.88..14539356.27 rows=2308 width=90)
 -> Append (cost=26898.88..14539356.27 rows=2308 width=90)
    -> Subquery Scan *SELECT* 1 (cost=26898.88..26907.58 rows=1 width=90)
       -> Merge Join (cost=26898.88..26907.58 rows=1 width=90)
          -> Sort (cost=361.90..361.90 rows=2343 width=30)
             -> Seq Scan on allocation (cost=0.00..230.75 rows=2343 width=30)
          -> Sort (cost=26536.98..26536.98 rows=1136 width=79)
             -> Subquery Scan vtb_timechargedsum (cost=26280.61..26479.35 rows=1136 width=79)
                -> Aggregate (cost=26280.61..26479.35 rows=1136 width=79)
                   -> Group (cost=26280.61..26450.95 rows=11357 width=79)
                      -> Sort (cost=26280.61..26280.61 rows=11357 width=79)
                         -> Hash Join (cost=21228.72..25222.62 rows=11357 width=79)
                            -> Merge Join (cost=21224.65..24322.40 rows=39828 width=63)
                               -> Index Scan using posemp_2_idx on posemp (cost=0.00..33.13 rows=508 width=16)
                               -> Sort (cost=21224.65..21224.65 rows=107217 width=47)
                                  -> Hash Join (cost=1.30..6817.45 rows=107217 width=47)
                                     -> Merge Join (cost=0.00..4939.85 rows=107217 width=39)
                                        -> Index Scan using timedetail_1_idx on timedetail (cost=0.00..3071.21 rows=107217 width=27)
                                        -> Index Scan using timecard_timecardid_key on timecard (cost=0.00..250.25 rows=4054 width=12)
                                     -> Hash (cost=1.24..1.24 rows=24 width=8)
                                        -> Seq Scan on payperiod (cost=0.00..1.24 rows=24 width=8)
                            -> Hash (cost=3.66..3.66 rows=166 width=16)
                               -> Seq Scan on orgprog (cost=0.00..3.66 rows=166 width=16)
                            SubPlan
                             -> Aggregate (cost=120.72..120.72 rows=1 width=24)
                                -> Nested Loop (cost=0.00..120.72 rows=1 width=24)
                                   -> Nested Loop (cost=0.00..119.18 rows=1 width=16)
                                      -> Index Scan using timecard_2_idx on timecard tc (cost=0.00..47.20 rows=13 width=8)
                                      -> Index Scan using timedetail_1_idx on timedetail td (cost=0.00..5.69 rows=1 width=8)
                                   -> Seq Scan on payperiod pp (cost=0.00..1.24 rows=24 width=8)
                             -> Aggregate (cost=120.72..120.72 rows=1 width=24)
                                -> Nested Loop (cost=0.00..120.72 rows=1 width=24)
                                   -> Nested Loop (cost=0.00..119.18 rows=1 width=16)
                                      -> Index Scan using timecard_2_idx on timecard tc (cost=0.00..47.20 rows=13 width=8)
                                      -> Index Scan using timedetail_1_idx on timedetail td (cost=0.00..5.69 rows=1 width=8)
                                   -> Seq Scan on payperiod pp (cost=0.00..1.24 rows=24 width=8)
    -> Subquery Scan *SELECT* 2 (cost=0.00..14485969.35 rows=1172 width=30)
       -> Seq Scan on allocation (cost=0.00..14485969.35 rows=1172 width=30)
          SubPlan
           -> Nested Loop (cost=1375.21..1665.03 rows=1 width=79)
              -> Nested Loop (cost=1375.21..1661.26 rows=1 width=63)
                 -> Index Scan using posemp_posempid_key on posemp (cost=0.00..5.59 rows=1 width=16)
                 -> Materialize (cost=1648.64..1648.64 rows=402 width=47)
                    -> Hash Join (cost=1375.21..1648.64 rows=402 width=47)
                       -> Merge Join (cost=1373.91..1640.31 rows=402 width=39)
                          -> Index Scan using timecard_timecardid_key on timecard (cost=0.00..250.25 rows=4054 width=12)
                          -> Sort (cost=1373.91..1373.91 rows=402 width=27)
                             -> Index Scan using timedetail_2_idx on timedetail (cost=0.00..1356.54 rows=402 width=27)
                       -> Hash (cost=1.24..1.24 rows=24 width=8)
                          -> Seq Scan on payperiod (cost=0.00..1.24 rows=24 width=8)
              -> Index Scan using orgprog_1_idx on orgprog (cost=0.00..3.75 rows=1 width=16)
              SubPlan
               -> Aggregate (cost=120.72..120.72 rows=1 width=24)
                  -> Nested Loop (cost=0.00..120.72 rows=1 width=24)
                     -> Nested Loop (cost=0.00..119.18 rows=1 width=16)
                        -> Index Scan using timecard_2_idx on timecard tc (cost=0.00..47.20 rows=13 width=8)
                        -> Index Scan using timedetail_1_idx on timedetail td (cost=0.00..5.69 rows=1 width=8)
                     -> Seq Scan on payperiod pp (cost=0.00..1.24 rows=24 width=8)
               -> Aggregate (cost=120.72..120.72 rows=1 width=24)
                  -> Nested Loop (cost=0.00..120.72 rows=1 width=24)
                     -> Nested Loop (cost=0.00..119.18 rows=1 width=16)
                        -> Index Scan using timecard_2_idx on timecard tc (cost=0.00..47.20 rows=13 width=8)
                        -> Index Scan using timedetail_1_idx on timedetail td (cost=0.00..5.69 rows=1 width=8)
                     -> Seq Scan on payperiod pp (cost=0.00..1.24 rows=24 width=8)
    -> Subquery Scan *SELECT* 3 (cost=26280.61..26479.35 rows=1136 width=79)
       -> Subquery Scan vtb_timechargedsum (cost=26280.61..26479.35 rows=1136 width=79)
          -> Aggregate (cost=26280.61..26479.35 rows=1136 width=79)
             -> Group (cost=26280.61..26450.95 rows=11357 width=79)
                -> Sort (cost=26280.61..26280.61 rows=11357 width=79)
                   -> Hash Join (cost=21228.72..25222.62 rows=11357 width=79)
                      -> Merge Join (cost=21224.65..24322.40 rows=39828 width=63)
                         -> Index Scan using posemp_2_idx on posemp (cost=0.00..33.13 rows=508 width=16)
                         -> Sort (cost=21224.65..21224.65 rows=107217 width=47)
                            -> Hash Join (cost=1.30..6817.45 rows=107217 width=47)
                               -> Merge Join (cost=0.00..4939.85 rows=107217 width=39)
                                  -> Index Scan using timedetail_1_idx on timedetail (cost=0.00..3071.21 rows=107217 width=27)
                                  -> Index Scan using timecard_timecardid_key on timecard (cost=0.00..250.25 rows=4054 width=12)
                               -> Hash (cost=1.24..1.24 rows=24 width=8)
                                  -> Seq Scan on payperiod (cost=0.00..1.24 rows=24 width=8)
                      -> Hash (cost=3.66..3.66 rows=166 width=16)
                         -> Seq Scan on orgprog (cost=0.00..3.66 rows=166 width=16)
                      SubPlan
                       -> Aggregate (cost=120.72..120.72 rows=1 width=24)
                          -> Nested Loop (cost=0.00..120.72 rows=1 width=24)
                             -> Nested Loop (cost=0.00..119.18 rows=1 width=16)
                                -> Index Scan using timecard_2_idx on timecard tc (cost=0.00..47.20 rows=13 width=8)
                                -> Index Scan using timedetail_1_idx on timedetail td (cost=0.00..5.69 rows=1 width=8)
                             -> Seq Scan on payperiod pp (cost=0.00..1.24 rows=24 width=8)
                       -> Aggregate (cost=120.72..120.72 rows=1 width=24)
                          -> Nested Loop (cost=0.00..120.72 rows=1 width=24)
                             -> Nested Loop (cost=0.00..119.18 rows=1 width=16)
                                -> Index Scan using timecard_2_idx on timecard tc (cost=0.00..47.20 rows=13 width=8)
                                -> Index Scan using timedetail_1_idx on timedetail td (cost=0.00..5.69 rows=1 width=8)
                             -> Seq Scan on payperiod pp (cost=0.00..1.24 rows=24 width=8)
          SubPlan
           -> Index Scan using allocation_uidx on allocation (cost=0.00..5.99 rows=1 width=71)
EXPLAIN