Slow UPDATE query | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Slow UPDATE query

Hi, Not really sure if this is the correct tread, but anyway?
I’m trying to imigrate a small community from Access DB to SQL-server DB.
Most works well, but it’s much slower in SQL-server DB?
I can’t figure out what the problem is. In one query I get Timeout error, It’s when I’m trying to update a table for guestbook, when a message has been read: UPDATE GUESTBOOK SET status = 1 WHERE status = 0 AND member_id = member_id; (member_id is a 20 character String – if that matter?) In the same page i write out the guestbook messages. When I delete (comment off) the UPDATE query everything works fine.
The most strange thing is that I get timeout even if the table is empty, or just few 1-2) rows into? I’m using SQL-Server ODBC-connection, SQL-Server 2000. Thankfull for all help,
UPDATE GUESTBOOK SET status = 1 WHERE status = 0 AND member_id = member_id Is that you actual query? If so, its understandable that it could run slow. It will update all records with a status of 0 since you have member_id = member_id If you’re passing a value for member_id and need it in your where clause sure you have an index on member_id Beyond that I’d need to know more information about the table structure and what else is in the procedure.

I think there is no need of comparing company_id unless you take it from other table Madhivanan
Maybe your intention was to update status for specific member:
UPDATE GUESTBOOK SET status = 1 WHERE member_id = @member_id
@member_id is parameter, member_id is GuestBook table column value.