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
 General SQL Server Forums
 New to SQL Server Programming
 Index in Temp Tables

Author  Topic 

ratheeshknair
Posting Yak Master

129 Posts

Posted - 2009-02-12 : 06:28:48
Hi Experts,

How to create index on temp tables?

And what are all the things taken care while using temp tables in Queries?


TIA

RKNAIR

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-12 : 06:31:06
You create index on temp tables exactly the same way your create index on ordinary tables.
However, not all contraints will be enforced on temp tables.
Foreign key contraints will be executed but not applied on temp tables.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-02-12 : 07:45:17
do you really want to create a temp table if its that large to require an index
Go to Top of Page

ratheeshknair
Posting Yak Master

129 Posts

Posted - 2009-02-12 : 08:29:11
Thanks to all

I am a pure DBA and dont know much on TSQL.Our organization have an application to record employees punch which is now facing some performance issue and I am trying to improve the performanceof that. When i went through execution plan of most procedures I found many uses temp table scan and its cost is 100%.

How can i improve the perofrmance of this application?

The issue is that sometimes noone is able to enter into that application. It shows a timeout error after entering username and password.

TIA

RKNAIR
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-12 : 08:30:51
Temp tables, or worktables (which is stored in TempDB)?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-12 : 08:31:52
Save the execution plan and post here, for further investigation.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-12 : 08:32:50
Then Read this:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=119616
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-02-12 : 10:01:02
Hooray -- I'm being helpful!


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -