Home All Groups Group Topic Archive Search About

Too slow updates in a large table - Please help

Author
28 Jul 2006 5:49 PM
Jay
I have a very standard UPDATE query wherein I am updating a column in
one table-1 with data from column in another table-2 using a INNER JOIN
- standard stuff.

Now, I have several identical table-1s which I am updating with the
identical SQL statements. When I run it on tables with around 700K
records it takes 3 mins. However, when I run it on tables with approx
1.5 Million records it does not finish even after 1 hour.

What could be causing this? How should I troubleshoot this? What could
be causing this?

Pls help.

Author
28 Jul 2006 6:14 PM
Arnie Rowland
Are the tables really identical? Could there be more indexes, or even
triggers? Are the in the same database, are the databases on the same server
instance.

First guess, it really sounds like indexing issues.

It would help us better assist you if you could include table DDL, the
UPDATE queries (or stored procedures). (For help with that refer to:
http://www.aspfaq.com/5006 ). Without this effort from you, we are just
playing guessing games.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


Show quote
"Jay" <jay6***@hotmail.com> wrote in message
news:1154108963.393594.71730@s13g2000cwa.googlegroups.com...
>I have a very standard UPDATE query wherein I am updating a column in
> one table-1 with data from column in another table-2 using a INNER JOIN
> - standard stuff.
>
> Now, I have several identical table-1s which I am updating with the
> identical SQL statements. When I run it on tables with around 700K
> records it takes 3 mins. However, when I run it on tables with approx
> 1.5 Million records it does not finish even after 1 hour.
>
> What could be causing this? How should I troubleshoot this? What could
> be causing this?
>
> Pls help.
>
Author
28 Jul 2006 6:23 PM
Tracy McKibben
Jay wrote:
Show quote
> I have a very standard UPDATE query wherein I am updating a column in
> one table-1 with data from column in another table-2 using a INNER JOIN
> - standard stuff.
>
> Now, I have several identical table-1s which I am updating with the
> identical SQL statements. When I run it on tables with around 700K
> records it takes 3 mins. However, when I run it on tables with approx
> 1.5 Million records it does not finish even after 1 hour.
>
> What could be causing this? How should I troubleshoot this? What could
> be causing this?
>
> Pls help.
>

Compare the execution plans between a query that runs fast, and one that
runs slow.  What are the differences?


--
Tracy McKibben
MCDBA
http://www.realsqlguy.com
Author
28 Jul 2006 7:11 PM
Steve Kass
Tracy,

A guess: the 700K-row table fits entirely in memory, but the 1.5M-row
table does not, and the query plan for the update has a nested loop join
or some other feature that results in the table's data pages being accessed
in a very scattered way.  If you are near the server, are you hearing the
disk drives make a lot of noise?

If this is the issue, there may be ways to get a query plan that accesses
the table more sequentially (with better indexing, or by putting the
relevant
columns of table 2 into a differently-indexed and narrower temporary table,
for example).  You could try (if feasible) breaking the update up into
smaller
chunks, too, which could help on its own or reduce the load having to do
with logging.

Steve Kass
Drew University

Tracy McKibben wrote:

Show quote
> Jay wrote:
>
>> I have a very standard UPDATE query wherein I am updating a column in
>> one table-1 with data from column in another table-2 using a INNER JOIN
>> - standard stuff.
>>
>> Now, I have several identical table-1s which I am updating with the
>> identical SQL statements. When I run it on tables with around 700K
>> records it takes 3 mins. However, when I run it on tables with approx
>> 1.5 Million records it does not finish even after 1 hour.
>>
>> What could be causing this? How should I troubleshoot this? What could
>> be causing this?
>> Pls help.
>>
>
> Compare the execution plans between a query that runs fast, and one
> that runs slow.  What are the differences?
>
>
Author
28 Jul 2006 7:13 PM
Steve Kass
Oops.  My apologies for replying to you in my previous message.

I should have replied to Jay!

SK

Tracy McKibben wrote:

Show quote
> Jay wrote:
>
>> I have a very standard UPDATE query wherein I am updating a column in
>> one table-1 with data from column in another table-2 using a INNER JOIN
>> - standard stuff.
>>
>> Now, I have several identical table-1s which I am updating with the
>> identical SQL statements. When I run it on tables with around 700K
>> records it takes 3 mins. However, when I run it on tables with approx
>> 1.5 Million records it does not finish even after 1 hour.
>>
>> What could be causing this? How should I troubleshoot this? What could
>> be causing this?
>> Pls help.
>>
>
> Compare the execution plans between a query that runs fast, and one
> that runs slow.  What are the differences?
>
>

AddThis Social Bookmark Button