Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DBAF2632D09 for ; Fri, 15 Jan 2010 19:24:49 -0400 (AST) 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 22406-05 for ; Fri, 15 Jan 2010 23:24:39 +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 49CA6632C94 for ; Fri, 15 Jan 2010 19:24:39 -0400 (AST) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NVvWr-0005cJ-Us; Sat, 16 Jan 2010 12:24:34 +1300 Message-ID: <4B50F92D.5020403@opencloud.com> Date: Sat, 16 Jan 2010 12:24:29 +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: <201001152307.o0FN7Aw2027525@web2.nidhog.com> In-Reply-To: <201001152307.o0FN7Aw2027525@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/30 X-Sequence-Number: 20226 John T. Dow wrote: > Following that, where my program would do the refreshRow on the original resultset, I find a 21 instances of this block (some lines omitted): > > 17:25:50.812 (1) simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@1142196, maxRows=0, fetchSize=0, flags=17 > 17:25:50.812 (1) FE=> Parse(stmt=null,query="SELECT attname FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2",oids={23,23}) > 17:25:50.812 (1) FE=> Bind(stmt=null,portal=null,$1=<16404>,$2=<1>) This is a metadata query, getting the canonical name of each field/column in your resultset so that updateRow() knows how to build the refresh query. > 17:38:47.031 (1) selecting select id, address, citystatezip, combined, degree, email, fax, firstname, groupname, lastname, nfiid, pabsid, practicetype, ssn, telephone, insertby, insertdate, inserttime, updateby, updatedate, updatetime from doctor where id= ? > 17:38:47.046 (1) simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@d3c6a3, maxRows=0, fetchSize=0, flags=17 > 17:38:47.046 (1) FE=> Parse(stmt=null,query="select id, address, citystatezip, combined, degree, email, fax, firstname, groupname, lastname, nfiid, pabsid, practicetype, ssn, telephone, insertby, insertdate, inserttime, updateby, updatedate, updatetime from doctor where id= $1",oids={1043}) > 17:38:47.046 (1) FE=> Bind(stmt=null,portal=null,$1=<0984>) > 17:38:47.046 (1) FE=> Describe(portal=null) > 17:38:47.046 (1) FE=> Execute(portal=null,limit=0) > 17:38:47.046 (1) FE=> Sync And this is the actual refreshRow() query. I assume that this WHERE clause looks correct for your table and that query should be pretty fast? > To me, who knows nothing, the mystery is why 21 repetitions? 21 columns. > I repeated this with another table. The original query had 792 rows. I went to the last row and made a change. This time there were 408 repetitions. Again, it used the primary key for the $1 parameter shown above. > > So why 408 repetitions this time? 408 columns. Is this a very wide SELECT? I can see that 408 roundtrips would slow things down a lot over a high-latency connection such as over the internet. Perhaps that's the cause of the slowdown you see.. -O