Home All Groups Group Topic Archive Search About

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

Author
20 Nov 2007 3:41 AM
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.

Author
21 Nov 2007 7:57 AM
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?

--
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/

Show quote
"DR" <softwareengineer98***@yahoo.com> wrote in message
news:%23Pu42cyKIHA.5360@TK2MSFTNGP03.phx.gbl...
>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.
>
Author
21 Nov 2007 9:35 PM
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

Show quote
"Miha Markic" <miha at rthand com> wrote in message
news:Ob0raTBLIHA.2268@TK2MSFTNGP02.phx.gbl...
> 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" <softwareengineer98***@yahoo.com> wrote in message
> news:%23Pu42cyKIHA.5360@TK2MSFTNGP03.phx.gbl...
>>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.
>>
>
Author
22 Nov 2007 9:17 AM
Miha Markic
You are talking about preallocation of temp table on the sql server, right?
How do you preallocate it?

--
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/

Show quote
"DR" <softwareengineer98***@yahoo.com> wrote in message
news:ub$%23fZILIHA.6008@TK2MSFTNGP05.phx.gbl...
> 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

AddThis Social Bookmark Button