Re: Update Performance
From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 01/10/05
- Next message: Brian Linden: "Re: Update Performance"
- Previous message: Aaron [SQL Server MVP]: "Re: Preventing a stored procedure to return result set"
- In reply to: Brian Linden: "Update Performance"
- Next in thread: raydan: "Re: Update Performance"
- Reply: raydan: "Re: Update Performance"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 Jan 2005 14:58:36 -0600
First thing I would do would be to add a unique index on the id column.
This should help out quite a bit, especially if you are modifying any other
rows in this table
The other obvious issue is that you are single threading all of your access
through this update. If you see the calls queuing up, then you may hve your
counter update inside a transaction and as such making the next update wait.
If the index doesn't help, consider having a table that instead of updating,
you simply write a new row in a table. This may actually cause more issues
with space, so you will need proper disk structures to help this, but it
should alleviate any single threading issues you are seeing. No you can
simply count the values when you need them.
-- ---------------------------------------------------------------------------- Louis Davidson - drsql@hotmail.com SQL Server MVP Compass Technology Management - www.compass.net Pro SQL Server 2000 Database Design - http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies may be ignored :) "Brian Linden" <brian@ineedadip.com> wrote in message news:%23cw%235C19EHA.2608@TK2MSFTNGP10.phx.gbl... >I have a stored procedure that is executed on every web request that we >get. > On the web server, I get about 50 Requests a second. > > After looking into the bad performance I narrowed it down to my update > statement in my stored proc: > Update tblStats set counter = counter + 1 Where id = @id > > If I comment out this line, I get about 350 Requests a second. > That is the kind of performance that I need. > > It is crucial that I keep a real-time counter for business logic purposes. > > I don't have any indexes on the table that I am updating. > Does anyone have any suggestions on what I can do to speed things up? > > Any suggestions would be appreciated. > >
- Next message: Brian Linden: "Re: Update Performance"
- Previous message: Aaron [SQL Server MVP]: "Re: Preventing a stored procedure to return result set"
- In reply to: Brian Linden: "Update Performance"
- Next in thread: raydan: "Re: Update Performance"
- Reply: raydan: "Re: Update Performance"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|