Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Should I use indexes?

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-30 : 22:13:00
I have a very large table (about 200,000 records), but there are only 2 fields in the table only one populated with data. I need to update the 2nd field with the first field's data.

UPDATE Table1
SET field2 = field1

This is taking a really long time to run about 3.5 minutes.
Is this normal? Can I create an index? What can I do to shorten the run time?

Thanks,
Ninel

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-30 : 22:14:10
Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71309


KH

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-08-30 : 22:30:42
Way to score an extra post khtan

I've locked the other thread.

No Ninel, and index won't help you there. Indexes help you find stuff, you are updating everything, so you don't need to find stuff.


Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-30 : 22:40:12
To save time, don't even run the update.

Since the value you want is in the first column, just use that.



CODO ERGO SUM
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-30 : 22:47:29
" Way to score an extra post khtan "

And here is another +1


KH

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-30 : 22:56:23
And another.

I'm fairly certain anything I post on this thread will not be doing anyone any good.




CODO ERGO SUM
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-30 : 23:14:50
quote:
Originally posted by Michael Valentine Jones

And another.

I'm fairly certain anything I post on this thread will not be doing anyone any good.




CODO ERGO SUM



. But your first advice is the best advice. Why doing something when you don't have to do it in the first place.


KH

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-30 : 23:30:48
quote:
Originally posted by khtan

quote:
Originally posted by Michael Valentine Jones

And another.

I'm fairly certain anything I post on this thread will not be doing anyone any good.




CODO ERGO SUM



. But your first advice is the best advice. Why doing something when you don't have to do it in the first place.


KH





Matthew 7:6 ...neither cast ye your pearls...




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -