pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
RE : Remote query very slow
2+ messages / 2 participants
[nested] [flat]

* RE : Remote query very slow
@ 2004-10-01 07:04 Johann Robette <jrobette@onyme.com>
  2004-10-01 07:36 ` Re: RE : Remote query very slow Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Johann Robette @ 2004-10-01 07:04 UTC (permalink / raw)
  To: 'Oliver Jowett' <oliver@opencloud.com>; +Cc: pgsql-jdbc

Thanks for your answer.
It seems that my problem lie on the not use of Statement.setFetchSize
and the use of the heap.

In fact, it appears that when I select all the fields, it's very slow
but when I select only the PK it's already better. So it seems that the
driver is waiting for the whole data and, only then, returns.

I should investigate in that way.

Last question, I'm using pgAdminIII to perform my queries. I think that
I should have the same problem on the server side than on the remote
machine as it is using the same driver. Am I wrong on that point?

Thanks a lot

-----Message d'origine-----
De : pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] De la part de Oliver Jowett
Envoyé : jeudi 30 septembre 2004 23:55
À : Johann Robette
Cc : pgsql-jdbc@postgresql.org
Objet : Re: [JDBC] Remote query very slow

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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: RE : Remote query very slow
  2004-10-01 07:04 RE : Remote query very slow Johann Robette <jrobette@onyme.com>
@ 2004-10-01 07:36 ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Jowett @ 2004-10-01 07:36 UTC (permalink / raw)
  To: Johann Robette <jrobette@onyme.com>; +Cc: pgsql-jdbc

Johann Robette wrote:

> Last question, I'm using pgAdminIII to perform my queries. I think that
> I should have the same problem on the server side than on the remote
> machine as it is using the same driver. Am I wrong on that point?

pgAdmin uses libpq for communication with the server, and is written in 
C. The JDBC driver implements the client/server protocol itself, and is 
written in Java. So they're not really comparable.

-O



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-10-01 07:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-01 07:04 RE : Remote query very slow Johann Robette <jrobette@onyme.com>
2004-10-01 07:36 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox