dbTalk Databases Forums  

Update query performance in transaction

microsoft.public.sqlserver.server microsoft.public.sqlserver.server


Discuss Update query performance in transaction in the microsoft.public.sqlserver.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sumanta Gayen
 
Posts: n/a

Default Update query performance in transaction - 12-08-2005 , 08:50 AM






I have got an update query which takes significantly more time if put within
a transaction (having another insert and update) than if run outside the
transaction.

In Transaction -> 34 min
Outside transaction -> 1 min

I have enough space for log file to grow.
What could be the reason for this difference?

The update looks something like this:
UPDATE we SET
we.BaseEntitlementKey = weBEKey.BaseEntitlementKey,
we.LastRefreshDate = @StartDate
FROM Warehouse.dbo.EntitlementBase we
INNER JOIN Delta.dbo.Entitlement de ON we.EntitlementID =
de.EntitlementID
INNER JOIN Staging.dbo.Wrk_EntitlementBase_PostLoad weBEKey (NOLOCK)
ON weBEKey.BaseEntitlementID = we.BaseEntitlementID

Reply With Quote
  #2  
Old   
ChrisR
 
Posts: n/a

Default RE: Update query performance in transaction - 12-08-2005 , 10:21 AM






Did you run sp_who to see if it's being blocked when doing the transaction?
--
TIA,
ChrisR


"Sumanta Gayen" wrote:

Quote:
I have got an update query which takes significantly more time if put within
a transaction (having another insert and update) than if run outside the
transaction.

In Transaction -> 34 min
Outside transaction -> 1 min

I have enough space for log file to grow.
What could be the reason for this difference?

The update looks something like this:
UPDATE we SET
we.BaseEntitlementKey = weBEKey.BaseEntitlementKey,
we.LastRefreshDate = @StartDate
FROM Warehouse.dbo.EntitlementBase we
INNER JOIN Delta.dbo.Entitlement de ON we.EntitlementID =
de.EntitlementID
INNER JOIN Staging.dbo.Wrk_EntitlementBase_PostLoad weBEKey (NOLOCK)
ON weBEKey.BaseEntitlementID = we.BaseEntitlementID

Reply With Quote
  #3  
Old   
Mike Epprecht \(SQL MVP\)
 
Posts: n/a

Default Re: Update query performance in transaction - 12-08-2005 , 04:21 PM



Hi

Even if you do not start a transaction, SQL Server will implicitly start one
for you for the batch.

As ChrisR said, check for blocking.

Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike (AT) epprecht (DOT) net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"Sumanta Gayen" <SumantaGayen (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have got an update query which takes significantly more time if put
within
a transaction (having another insert and update) than if run outside the
transaction.

In Transaction -> 34 min
Outside transaction -> 1 min

I have enough space for log file to grow.
What could be the reason for this difference?

The update looks something like this:
UPDATE we SET
we.BaseEntitlementKey = weBEKey.BaseEntitlementKey,
we.LastRefreshDate = @StartDate
FROM Warehouse.dbo.EntitlementBase we
INNER JOIN Delta.dbo.Entitlement de ON we.EntitlementID =
de.EntitlementID
INNER JOIN Staging.dbo.Wrk_EntitlementBase_PostLoad weBEKey
(NOLOCK)
ON weBEKey.BaseEntitlementID = we.BaseEntitlementID



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.