General discussion


how to optimize a update query

By amitbharadwaj ·
i am using sql server , and try to update a table a single field with a update query " update table alpha set field1='23' where field2='asd'"

now i have to run this kind of query 70 times/sec .Now in some cases query takes 7 ms to complete , but some time time increase to 200 ms , n i can't afford that . so can anybody help to reduce query time

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Tony Hopkinson In reply to how to optimize a update ...

Put an index on field2.
How often does the value in field1 chnage between updates, ie is it an event based update because something has chnaged or a polled one because it might have. Is the change significant ? If the change is infrequent then a check for a difference before doing the update may give you a performance improvement.

Last but not least, what is reading this data that has to be so dynamic ? If you can optimise there you'll be a lot better off, in particular I think a relational database is a bad tool to record data with a frequency of change like this, I'd be tempted to store it some where much slimmer and then read it from there when required.

Related Discussions

Related Forums