Skip to Content.
Sympa Menu

freetds - [freetds] most efficient way to scan an SQL Server 2005 table from Perl?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Amos Shapira" <amos.shapira AT gmail.com>
  • To: FreeTDS AT lists.ibiblio.org
  • Subject: [freetds] most efficient way to scan an SQL Server 2005 table from Perl?
  • Date: Wed, 18 Jul 2007 12:04:54 +1000

Hello,

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

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.

Thanks,

--Amos




Archive powered by MHonArc 2.6.24.

Top of Page