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 2008 Forums
 Transact-SQL (2008)
 Performance

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-20 : 13:59:11
I am using temp table to process the tasks.Does the temp tables will have performance issue..It is very slow..

Ex:

Select * into temp_test from test

Please suggest to resolve the performance issue..

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-04-20 : 14:38:26
Do not use a temp table. Use set-based logic instead of a cursor. Look both ways before you cross the road.










How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-20 : 14:44:25
Eat your veggies. Brush your teeth.

Your question is too vague to answer, and not even worded correctly. First, "temp_test" is not a temp table, it's a regular table. Second, how many rows are you selecting from test, and do you really need all of them?
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-20 : 15:42:32
Thanks for the response..There was typo..

Select * into #temp_test from test

secondly There nearly 10 million rows select from test table..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-20 : 15:44:04
do you have proper indexes created. Also are you sure you really want to work with all the 10 million rows?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-20 : 16:13:47
yes the process used all 10 millions rows as there is no index defined.I will add an index to the temp table.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2012-04-21 : 04:08:07
Do you have the hardware that support's the process on your 10 million rows ?

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-21 : 09:42:56
Yes
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2012-04-21 : 09:54:03
quote:
Originally posted by sqlfresher2k7

Yes



So whats the configuration ? Is tempdb optimised ? Do you observered any page allocation contentions on tempdb ?

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-04-23 : 06:42:59
I think the correct question has STILL not been asked. WHAT are you doing? Why do you think you need a 10 million row temp table?

The HOW TO ASK link should help you answer OUR question.









How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -