[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Question about temp tables

Roy Goldhammer

3/29/2007 2:39:00 PM

Hello there

If i just set SELECT INTO #tmp or
CREATE TABLE #TMP INSERT #tmp

where does the temp table is being saved? in the memory or in the HD


3 Answers

Russell Fields

3/29/2007 2:43:00 PM

0

#Temp tables are stored in tempdb. Yes, they really get written to disk,
but the normal memory caching function also work for these tables.

RLF
"Roy Goldhammer" <roy@hotmail.com> wrote in message
news:%23EkFE$gcHHA.2268@TK2MSFTNGP02.phx.gbl...
> Hello there
>
> If i just set SELECT INTO #tmp or
> CREATE TABLE #TMP INSERT #tmp
>
> where does the temp table is being saved? in the memory or in the HD
>


Roy Goldhammer

3/29/2007 3:13:00 PM

0

Explain little bit more Russell

I have some huge query that gives good data but with bad performance. In
order to inprove performance i took the hugest table that has 2.2 million
records and store part of that in temp table and run the query as it was
before.

This did improve performance. But what it means when more then one user is
trying to run it?

"Russell Fields" <russellfields@nomail.com> wrote in message
news:OR4u$BhcHHA.4004@TK2MSFTNGP06.phx.gbl...
> #Temp tables are stored in tempdb. Yes, they really get written to disk,
> but the normal memory caching function also work for these tables.
>
> RLF
> "Roy Goldhammer" <roy@hotmail.com> wrote in message
> news:%23EkFE$gcHHA.2268@TK2MSFTNGP02.phx.gbl...
>> Hello there
>>
>> If i just set SELECT INTO #tmp or
>> CREATE TABLE #TMP INSERT #tmp
>>
>> where does the temp table is being saved? in the memory or in the HD
>>
>
>


Russell Fields

3/29/2007 4:04:00 PM

0

Roy,

I think what you are asking is: Do different connections share the #Temp
table? If that is what you are asking, the answer is 'NO'. Each connection
has its own #Temp table.

If you had rights to see the tables in tempdb, you would not see a table
named #Temp, but a table named something like:
#temp______ (many underscores deleted )_____0000000015F1

RLF
"Roy Goldhammer" <roy@hotmail.com> wrote in message
news:OOI5oRhcHHA.4864@TK2MSFTNGP05.phx.gbl...
> Explain little bit more Russell
>
> I have some huge query that gives good data but with bad performance. In
> order to inprove performance i took the hugest table that has 2.2 million
> records and store part of that in temp table and run the query as it was
> before.
>
> This did improve performance. But what it means when more then one user is
> trying to run it?
>
> "Russell Fields" <russellfields@nomail.com> wrote in message
> news:OR4u$BhcHHA.4004@TK2MSFTNGP06.phx.gbl...
>> #Temp tables are stored in tempdb. Yes, they really get written to disk,
>> but the normal memory caching function also work for these tables.
>>
>> RLF
>> "Roy Goldhammer" <roy@hotmail.com> wrote in message
>> news:%23EkFE$gcHHA.2268@TK2MSFTNGP02.phx.gbl...
>>> Hello there
>>>
>>> If i just set SELECT INTO #tmp or
>>> CREATE TABLE #TMP INSERT #tmp
>>>
>>> where does the temp table is being saved? in the memory or in the HD
>>>
>>
>>
>
>