Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: update with multi table join
Ken Chesak wrote:
> Daniel Morgan <dmorgan_at_exesolutions.com> wrote in message news:<3D820817.676C42D9_at_exesolutions.com>...
> > Ken Chesak wrote:
> >
> > > I am using the following SQL to update a table. It requires a join to
> > > 4 other tables. This update takes about 35 minutes to run on 20,000
> > > records. That seems rather long. Is there a better way to perform
> > > this update?
> > > Thank,
> > > ex-Sybase programmer
> > >
> > > for m_rec in
> > > (select c.cd_income,b.id_tsi,b.id_line
> > > from w_tsi_payer a,
> > > w_tsi_income b,
> > > tsi_type_income c,
> > > w_rg101 d,
> > > w_tsi_client e
> > > where e.id_rg101 = d.id_rg101
> > > and b.id_tsi = a.id_tsi
> > > and a.id_tsi = e.id_tsi
> > > and b.id_line = a.id_line
> > > and d.cd_case_category = c.cd_case_category
> > > and a.payer_doc_type = c.payer_doc_type
> > > and b.type_income = c.type_income )
> > >
> > > loop
> > > update w_tsi_income
> > > set cd_income = m_rec.cd_income
> > > where id_tsi = m_rec.id_tsi
> > > and id_line = m_rec.id_line;
> > > end loop;
> > >
> > > commit;
> >
> > No platform. No operating system. No Oracle version or edition. No
> > indication of whether the optimizer is RULE or CBO. No indication whether
> > statistics are current if CBO. No indication of whether indexes exist on
> > any of the columns in either WHERE clause, no EXPLAIN PLAN. No TKPROF.
> >
> > How much help do you expect? ;-)
> >
> > Add rowid to your cursor and update by rowid. May not do a darned thing
> > but then your posting didn't either.
> >
> > Daniel Morgan
>
>
>
But part of the problem may be 8.1.7.2.0. My recollection is that this version had a bug in the optimizer code (I could be wrong on this so check it out). If there is no reason not to ... patch it or upgrade to 8.1.7.3 or 8.1.7.4.
Daniel Morgan Received on Mon Sep 16 2002 - 11:04:57 CDT