X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 607D832A1D2 for ; Thu, 30 Sep 2004 22:55:28 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57669-08 for ; Thu, 30 Sep 2004 21:55:22 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 556E532A152 for ; Thu, 30 Sep 2004 22:55:22 +0100 (BST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CD8tR-00010Y-00; Fri, 01 Oct 2004 09:55:17 +1200 Message-ID: <415C80C2.4010404@opencloud.com> Date: Fri, 01 Oct 2004 09:55:14 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Johann Robette Cc: pgsql-jdbc@postgresql.org Subject: Re: Remote query very slow References: <003101c4a6d2$ec1971d0$a5010a0a@Johann> In-Reply-To: <003101c4a6d2$ec1971d0$a5010a0a@Johann> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/215 X-Sequence-Number: 11105 Johann Robette wrote: > I’ve installed postgres 7.3.5 on a fedora server. It works fine, at > least on a local basis. I perform an easy select * from a table and I > get the answer in approximatively 1s. > > Now, I used the jdbc driver (jdbc3) for postgres. It connects fine but, > performing the same query, I get the answer in 7s. > > What could be my problem? Is it really a "remote query" problem? Or is it just a difference between using psql and JDBC? How fast is the query if you run it "remotely" via psql? (psql -h server database) GC is the most likely culprit if you are running with default heap settings and a large data set. Without instructions to the contrary (e.g. Statement.setFetchSize) the driver will try to pull the entire resultset into heap before returning from query execution. Try turning on -verbose:gc on your JVM and see how much time is spent doing GC. You probably want to upgrade both your server and JDBC driver (assuming you're using the 7.3-era driver) if you can. The 7.3 server is getting quite old now, and there are a lot of bugfixes in the current driver that aren't in the 7.3 JDBC driver. -O