Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

High Plan count & locking on a simple update query

$
0
0

Hi all, 

I am trying to understand why the below query shows a very high plan count (around 700) on our sql server, I also suspect that it is locking the table during the update. I assume that it has something to do with the columns that get set to the value of another column from the same row (since everything else is parameterized) as indicated by "PrevUpdate=LastUpdate" and "PrevRegData=RegData" . Can anyone help with suggestions on how this query could be improved ? 

Update RawDeviceData SET Timestamp=@Timestamp, PrevNumVals=NumVals, PrevUpdate=LastUpdate, NumVals=@data, LastUpdate=@LastUpdate, Msg=@Msg, PrevRegData=RegData, RegData=@RegData  WHERE hid=@hid

The RawDeviceData Table currently has 2 indexes on it the HID column (this is a clustered index) and another column HardwareID (non-clustered)

Thank you



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>