[dba-SQLServer] SELECT INTO Versus CREATE #temp

Asger Blond ab-mi at post3.tele.dk
Fri Jul 18 18:23:24 CDT 2008


Another thing to consider:
SQL Server 2005 uses tempdb more heavily than pervious versions does, and it
appears that you do too.
To boost performance it's good practice to place the tempdb database and its
log file on fast disks (and not in the default folder created when
installing SQL Server).
Maybe you already know, but here are the steps to move the tempdb database:

ALTER DATABASE tempdb MODIFY FILE 
(name='tempdev', filename='X:\TempDBData\tempdb.mdf')
ALTER DATABASE tempdb MODIFY FILE 
(name='templog', filename='Y:\TempDBLog\templog.ldf')

To make use of the new file-placements, restart SQL Server.

Asger
-----Oprindelig meddelelse-----
Fra: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] På vegne af Arthur
Fuller
Sendt: 18. juli 2008 23:31
Til: Discussion concerning MS SQL Server
Emne: Re: [dba-SQLServer] SELECT INTO Versus CREATE #temp

Something to consider. I'm still inspecting the previous code but I will
make sure to look for ## in the code.

We are still trying to figure out why U2 ended up with U1's data and it does
not happen consistently so this one is maybe going to take a while to
resolve.

Thanks,
Arthur

On Fri, Jul 18, 2008 at 6:17 PM, Francisco Tapia <fhtapia at gmail.com> wrote:

> Not at all, each execution of a sproc should be in it's own session. thus
> after the 2nd create table, you should be able to view the Temp Tables in
> the TempDB and see that you have #Asger000000000000000001 and
> #Asger000000000000000002 (or some such number).  I'm not sure why User 1
> would have User2's data unless you were createing ## temporary tables
which
> expand beyond the current users' session.
>
>
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com






More information about the dba-SQLServer mailing list