From: Arie Ozarov <aozarov@hi5.com>
To: pgsql-jdbc@postgresql.org
Subject: Performance comparison to psql.
Date: Tue, 05 Feb 2008 13:42:36 -0800
Message-ID: <C3CE184C.E6B%aozarov@hi5.com> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: aozarov@hi5.com
Subject: Re: Performance comparison to psql.
In-Reply-To: <C3CE184C.E6B%aozarov@hi5.com>
References: <C3CE184C.E6B%aozarov@hi5.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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