Re: extra index scans on update
From: Delbert Glass (delbert_at_noincoming.com)
Date: 03/24/04
- Next message: Anith Sen: "Re: Are you guys sure about '+' in this sp"
- Previous message: Delbert Glass: "Re: PWDCOMPARE"
- In reply to: Scott: "extra index scans on update"
- Next in thread: Scott Dubler: "Re: extra index scans on update"
- Reply: Scott Dubler: "Re: extra index scans on update"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 16:01:09 -0600
Perhaps datatype of colx and x are different.
(Let me guess, n is about 50 too.)
Bye,
Delbert Glass
"Scott" <anonymous@discussions.microsoft.com> wrote in message
news:5751C499-0B63-4E67-AE8A-5893A68F0EC0@microsoft.com...
> When I initiate a simple update on a single row in a table, I am
generating dozens of index scans for reasons I don't understand. The form of
the query is
>
> update table1 set col0=0, col1=1, col2=2, col3=3,..,coln=n where colx=x
>
> colx is a clustered primary key. Only a single row is updated for each
command.
>
> When I try to analyze what is going on in SQL Profiler I see:
> SQL:BatchStarting
> SCAN:Started
> SCAN:Stopped
> ... (about 50 scans occur)
> SCAN:Started
> SCAN:Stopped
> SP:CacheInsert
> SQL:StmtStarting
> SP:CacheHit
> SQLTransaction
> Excecution Plan
> ...From this point on it appears that the update occurs without any
superfluous actions
>
> If I run the same command again, it works much faster because there are
many fewer scans. The only thing I can think of is that SQL Server is
unsuccessfully scanning the first 50 times because the row is not in the
cache. When I run the same command again, the row is in the cache and things
work quickly.
>
> Another strange behavior is that updates occur slowly on a table with 6000
rows while the updates occur quickly on a table with 300,000 rows. Both
updates are similar in that I am using a primary key to select a single row
to update.
>
> Thanks for your help.
- Next message: Anith Sen: "Re: Are you guys sure about '+' in this sp"
- Previous message: Delbert Glass: "Re: PWDCOMPARE"
- In reply to: Scott: "extra index scans on update"
- Next in thread: Scott Dubler: "Re: extra index scans on update"
- Reply: Scott Dubler: "Re: extra index scans on update"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|