JDBC Query performance

From: "Postgres mailing lists" <postgres(at)weblynk(dot)com>
To: <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: JDBC Query performance
Date: 1999-03-18 08:53:36
Message-ID: 003101be711c$d09ff740$64ba01cc@earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello,
I've been using the JDBC driver that came with postgres 6.4.2. It seems
to work pretty well, but noticed that the query performance seemed very low.
For example, I have a table with about 1200 rows, 20 columns. I'm not using
indexes yet. I do a query using psql like "select * from mytable" and pipe
it to a file. It takes about a second or so to complete and I notice the CPU
idle time goes to maybe 50%. Pretty fast. Doing the same query using the
JDBC driver takes the CPU idle to 0% for about 90 seconds, then finally
returns. A code fragment...

String sql = "select * from mytable";
Connection conn = get_con(); // uses a DbConnectionBroker class. Performs
the same with or without this class.
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);

more = rs.next();

Trace("Finished Query. Filling Vector." );

while (more) {
count ++;
vector.addElement((new Long(rs.getLong("ID")).toString()));
vector.addElement(rs.getString("Name"));
etc...
more = rs.next();
}

rs.close();
stmt.close();
...

The executeQuery(sql) statement takes about 90 secs, then I see the Trace
output, then the vector operations take about 10-15 secs. I suppose I can
live with the Vector op time, if there is no more effecient way of getting
query results, (I haven't really looked into it), but 90 secs for executing
the query seems unreasonable.
Anyone else experience this type of thing?

Thanks in Advance.
Rich.

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 1999-03-18 09:07:10 RE: [INTERFACES] JDBC Query performance
Previous Message Gregory W Burnham 1999-03-17 22:52:38 lo_open() - truncate a large object?