Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL indexes

Status
Not open for further replies.

jepatte

Programmer
Jul 4, 2005
75
US
I have a table with 2.5 mil records and one field is a varchar 50 which I have an index on. Although, I need to run a query to append some text on the values in this field.

But this takes over an hour to run. Is this normal?
 
I don't think that's normal.

You may get better performance by removing the index, updating the data, and then re-creating the index. It's worth a try.

-George

"the screen with the little boxes in the window." - Moron
 
is there a special way to do in batches or do you mean just
add a where clause to do 50,000 based on the indentity seed or something like that?
 
Just to add to what George and Denis stated. Seeing that you are working with 2.5 mil records, make sure you have enough space to hold a copy of that data for re-creating the index if it's a clustered index. SQL Serevr will create a copy of the table then sort it then the original table dropped.

Good Luck



Well Done is better than well said
- Ben Franklin
 
We have plenty of space, although, its not a clustered index. Should it be clustered?
 
>> Should it be clustered?

Probably not. Clustered indexes have better performance than non-clustered indexes. Also, you can only have 1 clustered index per table. Therefore, it makes the most sense to have the clustered index on the column(s) that improve overall performance the most. Usually, clustered indexes are put on the primary key column(s) of a table.

-George

"the screen with the little boxes in the window." - Moron
 
No, leave it as is. If it was clustered this is something you would have to take into consideration but it is not, so don't worry about it.

Well Done is better than well said
- Ben Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top