|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returnI 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? -- Show quoteMiha 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. > 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. >> > You are talking about preallocation of temp table on the sql server, right?
How do you preallocate it? -- Show quoteMiha 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: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 |
|||||||||||||||||||||||