[freetds] most efficient way to scan an SQL Server 2005 table from Perl?
amos.shapira at gmail.com
Tue Jul 17 22:04:54 EDT 2007
Our resident Windows/C++/SQL-Server expert says that the default way queries
are done on the SQL Server 2005 (and which is used in our legacy code)
causes it to create a temporary table with all the select's results on the
server side before feeding them to the client.
He says he managed to avoid this in his C++ code on Windows and get the
results fed stright to the client using some ODBC tricks and games with the
resultset size, but I didn't quite understand what functions he used for
Now my job involves mostly writing Perl code on Linux that queries these
tables and I'm now writing a script which is going to scan a very large
table row-by-row to do some statistics.
Can anyone point me as to what is the best way to do such a scan with
minimal load on the database server?
Looking around the DBD/DBI/ODBS/Sybase/FreeTDS docs and questions I have a
very slight suspicion that I can help things by asking for a particular
cursor type (type 2?) but I'm not sure.
My platform for this script is Debian Etch, but I'm not shy of installing
anything reasonable that can help.
More information about the FreeTDS