Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: Table variables performance

$
0
0

Here's what I ran

 

create table #t (numberfield numeric(38,8) )

declare @t table (numberfield numeric(38,8) )

 

... insert 100,000 rows into #t

... insert 100,00 rows into @t

 

select sum(numberfield) from #t          

select sum(numberfield) from @t        

 

 

I've run this for 1000 rows into each table, below this number of rows table variables are quicker

 

select sum(numberfield) from #t                2.2 ms

select sum(numberfield) from @t               2.0 ms

 

With 100 rows, the table variables are a lot better

 

select sum(numberfield) from #t                0.804 ms

select sum(numberfield) from @t              0.038 ms (~20 times faster)

 

If its space related, then its seems that when the temp tables reach 128k table variables start to underperform compared to temp tables.

 

Is there some configuration to control when this happens ?


Viewing all articles
Browse latest Browse all 3587

Trending Articles



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