Is it normal for this query to take so long?

Red Squirrel

No Lifer
May 24, 2003
70,642
13,821
126
www.anyf.ca
I have an UPDATE query in a C# program that sets all the fields to 0 with no WHERE clause. There is about 600k items so yeah it's lot of data. the query craps out with a time out error so it never actually executes. Is there a way to speed up such query? Would indexing play a role here (doubt it, as I'm not using WHERE, just updating all records).

If I can't speed it up, is there a way within C# to stop it from timing out?
 

KLin

Lifer
Feb 29, 2000
30,441
752
126
Run the update command in sql management studio to see how long it takes.

EDIT: Indexing isn't going to help you if you're updating data.
 

FP

Diamond Member
Feb 24, 2005
4,568
0
0
Originally posted by: KLin
Run the update command in sql management studio to see how long it takes.

EDIT: Indexing isn't going to help you if you're updating data.

Indexing helps when updating. The query planner can use the index to identify the affected rows. If you are updating every row however the planner will probably opt for a full table scan.
 

KLin

Lifer
Feb 29, 2000
30,441
752
126
Originally posted by: FP
Originally posted by: KLin
Run the update command in sql management studio to see how long it takes.

EDIT: Indexing isn't going to help you if you're updating data.

Indexing helps when updating. The query planner can use the index to identify the affected rows. If you are updating every row however the planner will probably opt for a full table scan.

In the case you're using a where clause, you're correct. In the OP's case, it wouldn't.