Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D9FE9632761 for ; Mon, 20 Jul 2009 23:36:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 38159-07 for ; Mon, 20 Jul 2009 23:36:08 -0300 (ADT) X-Greylist: delayed 00:21:19.812252 by SQLgrey-1.7.6 Received: from saidar.elyograg.org (saidar.elyograg.org [166.70.79.215]) by mail.postgresql.org (Postfix) with ESMTP id 60B596326E1 for ; Mon, 20 Jul 2009 23:36:07 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by saidar.elyograg.org (Postfix) with ESMTP id BE87C5806D for ; Mon, 20 Jul 2009 20:14:45 -0600 (MDT) X-Virus-Scanned: Debian amavisd-new at saidar.elyograg.org Received: from saidar.elyograg.org ([127.0.0.1]) by localhost (saidar.elyograg.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bG+jYVAWRDy5 for ; Mon, 20 Jul 2009 20:14:39 -0600 (MDT) Received: from [192.168.1.100] (zeus.elyograg.org [192.168.1.100]) by saidar.elyograg.org (Postfix) with ESMTP id B94B958022 for ; Mon, 20 Jul 2009 20:14:39 -0600 (MDT) Message-ID: <4A65248C.8040406@elyograg.org> Date: Mon, 20 Jul 2009 20:14:36 -0600 From: Shawn Heisey User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Forcing cursor behavior Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/46 X-Sequence-Number: 19814 I have been scouring everything I can find trying to get my problem solved. I've turned up a number of discussions, but nothing so far that does what I want. I've got a java application, to which I cannot get source code, that needs to process a query with two million rows in it, out of 35 million total. Currently we use it with another database, and we are trying to migrate to Postgres. I've got it talking to the database via your driver, but it runs out of memory because the driver works as designed and tries to return the entire query at once. If I could modify the program, then I could just turn off autocommit, set the fetchsize, and everything would be well, but that's not an option. I want to modify the driver to force the cursor behavior with a fetchsize of 10,000 rows. The program does not modify the database, so I don't need to worry about autocommit. I've tried changing the code in every place that I can find, but haven't had any luck. It still compiles and works, but exactly the same way it did before. I have some experience with code, but my work experience is admin, not programming. I have no specific experience with Java. Would it be possible to patch the jdbc driver so that it will internally turn autcommit off, set the fetchsize to 10,000, and ignore any attempt by the application to change these parameters? Could someone create such a patch for me? I am using java 1.5, so the driver compiles as the 3g version.