Discussion Locked

how to optimize a update query

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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 ..how to reduce query time

1 reply

by tony hopkinson

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.

This discussion is closed to new replies.