I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am return

  • Thread starter Thread starter DR
  • Start date Start date
D

DR

I have a CLR function thet returns IEnumberable (a table) and it has a
FillRow function. I am returning 10,000 integers from this function. Is
there any way that I can preallocate the resulting table or give SQL server
hint as to how many rows my function will return? It makes me cringe to
think that every time FillRow is called that sql may be doing some memory
allocation to make the resulting table bigger.
 
You have to ask yourself whether you really need 10.000 records in first
place.
Why do you think sql server will work better if he'd know that he has to
return 10.000 records?
 
the relationship between size, preallocation, and speed is a fundemental
computer science topic. could research preallocation on google or
something.. acutaly if you know C# look into the difference between
concatination and stringbuilders should help with understanding
preallocation of temp tables

Miha Markic said:
You have to ask yourself whether you really need 10.000 records in first
place.
Why do you think sql server will work better if he'd know that he has to
return 10.000 records?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

DR said:
I have a CLR function thet returns IEnumberable (a table) and it has a
FillRow function. I am returning 10,000 integers from this function. Is
there any way that I can preallocate the resulting table or give SQL
server hint as to how many rows my function will return? It makes me
cringe to think that every time FillRow is called that sql may be doing
some memory allocation to make the resulting table bigger.
 
You are talking about preallocation of temp table on the sql server, right?
How do you preallocate it?
 
Back
Top