X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 62DF39FA621 for ; Tue, 18 Jul 2006 14:29:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 61622-07-3 for ; Tue, 18 Jul 2006 14:29:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id E32B09FB1CE for ; Tue, 18 Jul 2006 14:25:20 -0300 (ADT) Received: (qmail 2786 invoked from network); 18 Jul 2006 17:25:18 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 18 Jul 2006 17:25:18 -0000 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Prepared Statement Memory Size Date: Tue, 18 Jul 2006 13:25:16 -0400 To: jennie browne X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/65 X-Sequence-Number: 15491 Jennie, You say it returns a million rows, but you have a limit of 788 ?? How is that possible. What version of postgres, and driver are you using ? Dave On 18-Jul-06, at 12:42 PM, jennie browne wrote: > We have a prepared statement example below: > > > > Query = SELECT consumer.consumer_id, consumer.address, > consumer.operator_id > > FROM consumer > > INNER JOIN registration_list_consumer AS rlc ON > (consumer.consumer_id = rlc.consumer_id AND > rlc.registration_list_id = 15) > > INNER JOIN registration_list as rl on (rl.registration_list_id = > rlc.registration_list_id AND rl.status_id = 25 ) > > WHERE consumer.address_type_id IN (1) > > AND NOT EXISTS (SELECT 'x' FROM target_run_transaction trt > > WHERE consumer.consumer_id = trt.consumer_id AND trt.target_run_id > = 468) AND NOT EXISTS (SELECT 'x' FROM registration_list_consumer > AS rlc_exclude, registration_list rl WHERE > rlc_exclude.registration_list_id = rl.registration_list_id AND > rlc_exclude.consumer_id = consumer.consumer_id AND rl.status_id = 25 > > AND rlc_exclude.registration_list_id in (34)) ORDER BY RANDOM() > LIMIT 788 > > > > With no dynamic parameters populated during runtime > it will return roughly 1million rows. During execution of the query > the preparedStatment grows in size up to 80MB and beyond. > > > > We have the fetchSize set to 1000 > > And autocommit set to false. > > > > And the following params set > > > > > stmt = conn.prepareStatement > (query,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); > > > > can you suggest a work around to fix this problem > why is it taking up so much memory? > > > > Thanks, > > jennie > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster >