Re: Connection support only one query at a time
Matthias Cramer <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hi James You're my hero of the day ... I now open two connections at the beginning of my script. One to the outer loop and one for the inner querries. Execution time of my script is now down to 17s from >90s ... great. Thanks again for the enlightenment. Regards Matthias James K. Lowden wrote: > Matthias Cramer wrote: >> I use DBI:Sybase in perl to connect to a MS SQL Server 2008. I do >> several thousand queries in my script and for each it needs to open a >> new connection. > > Why do you need to open a second connection every time? Just maintain two > connections. > > There's no "workaround" in the sense that the TDS protocol requires the > client to finish processing the results of a query before issuing another > query on the same connection. Nothing prevents a client from maintaining > multiple connections, though. > > Think of it like a file: your program can have several files open at a > time, but each file handle deals with only one file. > > In case you're concerned about the overhead of maintaining the connection, > don't be. The original Sybase design minimized the memory requirements to > maintain a connection. At one time it was 15 KB. As of SQL Server 6.5 > it seems to have been 44 KB (http://support.microsoft.com/kb/160234). I > haven't been able to find more recent information, but it would be in the > vendor's interest to continue to keep it as small as possible. > > HTH. > > --jkl > _______________________________________________ > FreeTDS mailing list > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds -- Matthias Cramer / mc322-ripe System & Network Manager Interway Communication GmbH Phone +41 43 500 1111 Josefstrasse 225 Fax +41 44 271 3535 CH-8005 Zürich http://www.interway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250 _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds