Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 2CC6C659DE1 for ; Wed, 13 Jan 2010 16:40:01 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 63533-01 for ; Wed, 13 Jan 2010 20:39:46 +0000 (UTC) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id D25DA6374BE for ; Wed, 13 Jan 2010 16:36:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from s007.panelboxmanager.com (s007.panelboxmanager.com [72.55.186.10]) by mx1.hub.org (Postfix) with ESMTP id CD4AD3262775 for ; Wed, 13 Jan 2010 16:36:23 -0400 (AST) Received: from 75-119-251-59.dsl.teksavvy.com ([75.119.251.59] helo=intranet.sem.ca) by s007.panelboxmanager.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1NV9uq-0004IV-7M; Wed, 13 Jan 2010 15:34:08 -0500 Received: from [192.168.0.8] (laurent [192.168.0.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: laurent) by intranet.sem.ca (Postfix) with ESMTPSA id 0657C52E071; Wed, 13 Jan 2010 15:30:24 -0500 (EST) Message-ID: <4B4E2E3F.9090401@sem.ca> Date: Wed, 13 Jan 2010 15:34:07 -0500 From: Laurent Chouinard User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0b2pre Thunderbird/3.0 MIME-Version: 1.0 To: Craig Ringer CC: pgsql-odbc@postgresql.org Subject: Re: C# w/ ODBC, 2.1 million list select gives empty DataSet References: <4B4BB581.3050302@sem.ca> <4B4D4F0B.4000802@postnewspapers.com.au> In-Reply-To: <4B4D4F0B.4000802@postnewspapers.com.au> X-Enigmail-Version: 1.0 X-Stationery: 0.5 Content-Type: multipart/alternative; boundary="------------020903030708090705010702" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - s007.panelboxmanager.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sem.ca X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=-10 required=5 tests=BAYES_50=0.001, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201001/10 X-Sequence-Number: 10173 This is a multi-part message in MIME format. --------------020903030708090705010702 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 2010-01-12 23:41, Craig Ringer wrote: > On 12/01/2010 7:34 AM, Laurent Chouinard wrote: > >> With the new drivers, it still climbs to 700MB or so (makes sense, 2 >> million rows is quite a bit), and then after the "0 rows" returned, >> memory is cleared immediately. Makes sense as well, OBDC doesn't carry >> data anymore, dataset is almost null, garbage collector is having a >> field day. > > I don't use ODBC much personally and don't work on the driver - but it > sounds to me a lot like the new driver may be running out of memory > too, but is eating the failure (or reporting it via some side-channel) > rather than throwing. If it is, that'd be pretty bad behavior in my > personal opinion, but then I don't know ODBC well. Someone who does > may be able to shed some more light. > > My suggestion, though: Even if you resolve this now, as things > continue to grow you're still going to have OOM issues. Perhaps it'd > be a good idea to use a cursor for this? > You're right. For some reason, it completely escaped me that the new driver could be failing just as the previous one, but in a less acceptable way. Indeed, the use of a cursor seems logical when dealing with very large quantities of data, especially considering that 2.1 million rows is after only a year of use. My final solution must be future proof to some extent. I tried to have my code be as database-compatible as possible so that I can swap from Postgres to Microsoft easily depending on customer requirements. Using a cursor means I have a PG specific way, but then again, I could also find out how to do that in MS and call that a day. A long one, however! Thanks all for your inputs. Also, thanks Hiroshi for your suggestion for the other driver, but I will not venture into non-official releases at the moment because my product is already in use by customers. I can't rely on experimental or beta versions of code. Regards, Laurent Chouinard --------------020903030708090705010702 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 2010-01-12 23:41, Craig Ringer wrote:
On 12/01/2010 7:34 AM, Laurent Chouinard wrote:

With the new drivers, it still climbs to 700MB or so (makes sense, 2
million rows is quite a bit), and then after the "0 rows" returned,
memory is cleared immediately. Makes sense as well, OBDC doesn't carry
data anymore, dataset is almost null, garbage collector is having a
field day.

I don't use ODBC much personally and don't work on the driver - but it sounds to me a lot like the new driver may be running out of memory too, but is eating the failure (or reporting it via some side-channel) rather than throwing. If it is, that'd be pretty bad behavior in my personal opinion, but then I don't know ODBC well. Someone who does may be able to shed some more light.

My suggestion, though: Even if you resolve this now, as things continue to grow you're still going to have OOM issues. Perhaps it'd be a good idea to use a cursor for this?


You're right. For some reason, it completely escaped me that the new driver could be failing just as the previous one, but in a less acceptable way.

Indeed, the use of a cursor seems logical when dealing with very large quantities of data, especially considering that 2.1 million rows is after only a year of use. My final solution must be future proof to some extent. I tried to have my code be as database-compatible as possible so that I can swap from Postgres to Microsoft easily depending on customer requirements. Using a cursor means I have a PG specific way, but then again, I could also find out how to do that in MS and call that a day. A long one, however!

Thanks all for your inputs.

Also, thanks Hiroshi for your suggestion for the other driver, but I will not venture into non-official releases at the moment because my product is already in use by customers. I can't rely on experimental or beta versions of code.

Regards,
Laurent Chouinard
--------------020903030708090705010702--