On 18/07/07, Ron Savage <[EMAIL PROTECTED]> wrote:
Amos Shapira wrote: Hi Amos > Our local SQL Server/Windows/C++ guru told me that the standard way we scan > tables causes the server to practically copy the entire result set into a > temporary table on the server before feeding it to the client. I assume MS are so cynical they do this to deliberately slow down the process.
Hanlon's Razor: Don't attribute to malice what can be adequately explained by incompetence. Bruce's Razor: Don't attribute to incompetence what can be adequately explained by Microsoft funding. - Craig Bruce ( http://www.brainyquote.com/quotes/quotes/c/craigbruce189141.html)
He found a way to avoid this in C++ by some clever direct ODBC hacks on > Windows which make the server practically stream the results to the client > without creating a temporary table. > > Is there a way to achieve this with Perl on Linux too? Well, if you can publish his code here it should be convertible in Perl (perhaps with a C++ component). But if the code remain secret, I can't see how it can be replicated without being independently created.
Here is what I got from him: 1. A pointer to the MSDN article which (tries to) explain this. Maybe it's more meaningful to people with more experience with SQL Server than me (he specifically quotes the last paragraph beginning with "The SQL Server ODBC driver offers an optimization"): http://msdn2.microsoft.com/en-us/library/aa197691(sql.80).aspx 2. Pseudo code which supposedly demonstrate what this article is talking about: Set CursorType = forward_only, read_only Set RowSize = 1 ExecDirect( query ) SQLFetch Set RowSize = 1000 BindColums (To buffer big enough to hold 1000 rows) While ( moreResults ) Begin SQLFetchScroll( SQL_FETCH_NEXT ) end Thanks, --Amos
