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

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.
 
M

Miha Markic

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?
 
D

DR

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.
 
M

Miha Markic

You are talking about preallocation of temp table on the sql server, right?
How do you preallocate it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top