Improved Performance For Temp Table
Posted: Fri Nov 16, 2007 7:36 am
Hello:
Can anyone tell me if this should work out ok. I don't really like working
on my live server but want to make a change.
----------------------------------------------------
Currently I have:
~~~~~~~~~~~~~~~~~
SELECT
blah,
blah,
blah
into #temptable
FROM SourceTable
INNER JOIN ........
I am having some performance issues. I have read
not to use Select Into.
----------------------------------------------------
I am thinking about using:
~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT *
INTO #temptable
FROM SourceTable
WHERE 1 = 0
CREATE clusteredindex iname on #temptable (blah, blah)
INSERT #temptable
SELECT *
FROM SourceTable
INNER JOIN ..............
I am hoping this will improve performance but I want
to be sure I have the syntax correct. If I create
the clustered index then insert the data will it
work the way I am hoping?
----------------------------------------------------
Thanks for any help on this guys...
Can anyone tell me if this should work out ok. I don't really like working
on my live server but want to make a change.
----------------------------------------------------
Currently I have:
~~~~~~~~~~~~~~~~~
SELECT
blah,
blah,
blah
into #temptable
FROM SourceTable
INNER JOIN ........
I am having some performance issues. I have read
not to use Select Into.
----------------------------------------------------
I am thinking about using:
~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT *
INTO #temptable
FROM SourceTable
WHERE 1 = 0
CREATE clusteredindex iname on #temptable (blah, blah)
INSERT #temptable
SELECT *
FROM SourceTable
INNER JOIN ..............
I am hoping this will improve performance but I want
to be sure I have the syntax correct. If I create
the clustered index then insert the data will it
work the way I am hoping?
----------------------------------------------------
Thanks for any help on this guys...