Re: Multi column update
Date: Thu, 12 Nov 2009 08:18:22 +0100
Message-ID: <7m1r5uF3fl0jiU1_at_mid.individual.net>
On 12.11.2009 00:32, Sashi wrote:
> The sub-query runs in about 90 seconds and comes up with a result set
> with 132 records. In my example, this would be the B table. The A
> table also has the same number of records.
> However, the update runs for about 22 minutes.
> Since the subquery runs rather fast (and it has to go thru about 9
> million rows to come up with this summary), I'm surprised that the
> update should take so long.
> The example I've given is a sort of simplified version of my query,
> but it's a very good approximation.
> i.e., select sum(b1), sum(b2), sum(b3) from B group by b4 runs in less
> than 90 seconds.
> So it's safe to assume that the join condition is causing the
> inefficiency.
> Any ideas on how to make it run quicker?
You could look at the execution plan, e.g. with proper permissions set in SQL Plus SET AUTOTRACE ON or SET AUTOTRACE TRACEONLY.
Kind regards
robert
-- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/Received on Thu Nov 12 2009 - 01:18:22 CST