I do an UPDATE request from my client app to the database (SQL Server 2008 R2), and it takes 6 seconds to complete.
Currently I have around 5 millions rows in that table.
Here is the query:
UPDATE MyTable
SET subject2 = 'information abx', dateProcessed = '2012-02-27 23:02:44'
WHERE id = 3712028;
Where columns are:
[id] [int] IDENTITY(1,1) NOT NULL,
[dateProcessed] [datetime] NULL,
[subject2] [nvarchar](150) NULL,
Any ways to defragment database of something like that?? 🙂
I don’t think that 6 seconds is normal time to update 1 row searching by indexed field…
Any help is highly appreciated! Thanks,
UPDATE 1: I’m sorry guys! I don’t have indexes in the table. I thought IDENTITY is someth like INDEX also. So probably I should add INDEX to id field or make it PRIMARY KEY
Declaring a column
identitydoes not automatically makes it indexed; declaring it a primary key does:You can add the constraint to an existing database like this: