Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Insert into a temp table is to slow

$
0
0

i'd like to know why if i created a temp table out of my procedure the insert into it get slower than if i create that temp table inside my procedure. follows an example:

createtable#Test (col1 varchar(max))
gocreateproc dbo.testasbegintruncatetable#Testinsertinto#Testselect'teste'FROM sys.tablescrossjoin sys.columnsend
goexec dbo.test
gocreatetable#Test2 (col1 varchar(max))
gotruncatetable#Test2insertinto#Test2select'teste'FROM sys.tablescrossjoin sys.columns

At test, we get duration 71700, reads 45220, CPU 26052 At test2, we get duration 49636, reads 45166, cpu 24960

best regards


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>