postgresql – postgres query performance

I can’t find a good way to rewrite this query or improve the performance:


            update company_holding c
           set issuer_stim_buy_quarter = sq.estim_quarter_buy
            select h.company_id
                  ,var_quarter as quarter
                  ,min(h.quarter) as estim_quarter_buy
              from company_holding h
             where h.quarter <= var_quarter
               and h.issuer_tot_share > 0
            group by h.company_id, quarter, h.issuer_cusip
           ) sq
        where c.company_id = sq.company_id
          and c.issuer_cusip = sq.issuer_cusip
          and c.quarter = sq.quarter

Company_holding is a partitioned table.
This is the explain analyze: