Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 85A1D6325DE for ; Thu, 14 Jan 2010 20:38:15 -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 41055-09 for ; Fri, 15 Jan 2010 00:37:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id D9ECA6323AF for ; Thu, 14 Jan 2010 20:38:04 -0400 (AST) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.168]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NVaCO-0007Yx-5N; Fri, 15 Jan 2010 13:38:00 +1300 Message-ID: <4B4FB8E6.7040008@opencloud.com> Date: Fri, 15 Jan 2010 13:37:58 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: "John T. Dow" CC: "pgsql-jdbc@postgresql.org" Subject: Re: refreshRow is slow References: <201001150000.o0F003j8000495@web2.nidhog.com> In-Reply-To: <201001150000.o0F003j8000495@web2.nidhog.com> 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=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/19 X-Sequence-Number: 20215 John T. Dow wrote: > Each row in a postgres database has a unique identifier. I would think that refreshrow could use that to target the specific row to be refreshed. refreshRow() uses the primary key of the table to synthesize a SELECT to pick out just the one row, yes. If you explicitly select a column called "oid" in your query, it'll use that instead of the PK columns. (I looked at that code and there are a few ways to confuse it. That's why I want to know what the actual query that's causing problems is.) > > I realize that I only want to refresh one row, and that refreshrow actually uses the fetch size and may get more than one if required. Refreshing many rows using their unique identifiers might not be desirable. Huh? Fetch size should have no effect on refreshRow() - it should only be selecting a single row anyway. Again: What is the actual query being synthesized by refreshRow(), and have you tried analysing that query to work out why it's slow? Also, if you just want to do an UPDATE and have the freshly updated data appear in your resultset, why don't you use the ResultSet update interface? updateRow() populates the ResultSet row with the data sent to the backend as part of the update. -O