Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 0F7DFB5DBE6 for ; Tue, 5 Jul 2011 13:44:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 61091-04 for ; Tue, 5 Jul 2011 16:44:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mail.postgresql.org (Postfix) with ESMTP id C53F5B5DBDC for ; Tue, 5 Jul 2011 13:44:34 -0300 (ADT) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Qe8je-0000c9-TS for pgsql-odbc@postgresql.org; Tue, 05 Jul 2011 09:44:30 -0700 Date: Tue, 5 Jul 2011 09:44:30 -0700 (PDT) From: BGoebel To: pgsql-odbc@postgresql.org Message-ID: <1309884270900-4553904.post@n5.nabble.com> Subject: RowCount && UseDeclareFetch Performance MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.778 tagged_above=-10 required=5 tests=BAYES_00=-1.9, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201107/2 X-Sequence-Number: 10679 I am trying to optimize performance on larger selects sets: If i connect with *...UseDeclareFetch=0...* SQLGetDiagField(... SQL_DIAG_CURSOR_ROW_COUNT...) or SQLRowCount deliver the number of the rows which where found by the SELECT. Reading rowcount is needed by my ODBC wrapper. BUT: The SELECT needs MUCH more time(vs.UseDeclareFetch=1) and a lot of memory(~100MByte) is eaten up until the cursor ist closed. So far as i have understand, the result set is read by the client, which may also a problem on slow connections to the server. Therefore the amount of cached rows should be controlled by *Fetch=XXX* assigned to the connection string. But whatever i assigned to "Fetch", the return time for the SELECT and memory usage is nearly the same. Now i have tried *...UseDeclareFetch=1...*. The return time is MUCH better. BUT: Now SQLRowCount returns -1. One idea: Executing Select ...,(Select count(*) where {MyConditions}) as __ROWCOUNT where {MyConditions}. I suppose that would double the time on a complicate evaluation. Any ideas how to get the RowCount? Or to optimize Selects with UseDeclareFetch=0. I'm quite a newbie to PostgreSQL and i am nearly sure that i have overlook something. Any help would be greatly welcome! -- View this message in context: http://postgresql.1045698.n5.nabble.com/RowCount-UseDeclareFetch-Performance-tp4553904p4553904.html Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.