Performance comparison to psql.

From: Arie Ozarov <aozarov(at)hi5(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Performance comparison to psql.
Date: 2008-02-05 21:42:36
Message-ID: C3CE184C.E6B%aozarov@hi5.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

We compared insert & select operations between jdbc (postgres 8.2,
postgresql-8.2-506.jdbc3.jar) and psql.

Here are some numbers:

PSQL *COPY* from STDIN
recordsCount = 10 000 000

WITHOUT INDEXES: time = 50544 ms (*0.005 ms* per record)
WITH 2 INDEXES: time = 221491 ms (*0.022 ms* per record)

*JDBC (prepared statement without batch)*
recordsCount = 100 000

WITHOUT INDEXES: time = 64874 ms (*0.649 **ms* per record)
WITH 2 INDEXES: time = 63057 ms (*0.630 ms* per record)

*JDBC (**prepared statement with batch**)*
recordsCount = 1 000 000

WITHOUT INDEXES: time = 73205 ms (*0.073** ms* per record)
WITH 2 INDEXES: time = 100270 ms (*0.100 ms* per record)

Comparison table (records inserted per millisecond)
COPY JDBC JDBC batch
WITHOUT INDEXES: 198 1.5 14
WITH 2 INDEXES: 45 1.5 10

As for select/queries psql was about 3 times faster.
Both psql and jdbc operations were done remotely from the same machine.

I understand that JDBC has some overhead (object translation,..) but didn't
think the difference would be that big. Do this numbers look correct (any
optimization suggestion?)

Any performance improvement in postgresql-8.2-507.jdbc4.jar?

Is the copy operation much more optimized than inserts (and if so when/will
the driver support it)?

Thanks,
Arie.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2008-02-05 22:31:54 Re: Performance comparison to psql.
Previous Message Brian Tomaszewski 2008-02-05 21:21:50 Re: JDBC connection problem