pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Crooke <dcrooke@gmail.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-jdbc@postgresql.org, pgsql-performance <pgsql-performance@postgresql.org>
Cc: Scott Carey <scott@richrelevance.com>
Subject: Re: SOLVED ... Re: Getting rid of a cursor from JDBC .... Re: [PERFORM] Re: HELP: How to tame the 8.3.x JDBC driver with a biq guery result set
Date: Tue, 20 Apr 2010 15:40:14 -0500
Message-ID: <w2oca24673e1004201340p703b0121iaf852aa28695be65@mail.gmail.com> (raw)
In-Reply-To: <4BCDC6B90200002500030C09@gw.wicourts.gov>
References: <q2sca24673e1004191633j10b1124amf1eb51f3bd84f19a@mail.gmail.com>
	<4BCD73AF0200002500030BC2@gw.wicourts.gov>
	<w2kca24673e1004200847k77429a1cra0a6f3560d407d8e@mail.gmail.com>
	<4BCD90D80200002500030BDD@gw.wicourts.gov>
	<x2zca24673e1004201229n653f4e69vd274af4a4aa22d09@mail.gmail.com>
	<4BCDC6B90200002500030C09@gw.wicourts.gov>

I digest this down to "this is the best that can be achieved on a connection
that's single threaded"

I think the big difference with Oracle is this:

i. in Oracle, a SELECT does not have to be a transaction, in the sense that
PG's SELECT does ... but in Oracle, a SELECT can fail mid-stream if you wait
too long and the UNDO tablespace wraps (ORA-600), i.e. Oracle does not lock
on SELECT. Oracle is optimized for lots of small transactions that typically
commit, PG supports arbitrary transaction mixes of any size, but is less
efficient at the workload for which Oracle is specialized.

ii. SELECT always creates an implicit cursor in Oracle, but access to these
cursors can be interleaved arbitrarily on one connection both with each
other and transactions (writes)

After consiering the context you offered, I'd recommend the following two
minor changes to the PG driver ....

a. Make setFetchSize(10000) the default

b. If someone does call rs.close() before the end of the ResultSet, and has
not created an explicit cursor at the JDBC level, flag the query / lock /
virtual transaction in some way in the JDBC driver that tells it that it can
just dump the cursor on a subsequent stmt.close(), conn.commit() or
conn.close() call without sucking down the rest of the data.

AFAICT, this will make the behaviour more like other DB's without sacrifcing
anything, but I don't know what default behaviour expectations might be out
there in PG land.

Cheers
Dave

On Tue, Apr 20, 2010 at 3:22 PM, Kevin Grittner <Kevin.Grittner@wicourts.gov
> wrote:
(Lots of good explanatory stuff)

view thread (16+ messages)  latest in thread

Message-ID: <w2oca24673e1004201340p703b0121iaf852aa28695be65@mail.gmail.com>
Permalink:  ../w2oca24673e1004201340p703b0121iaf852aa28695be65@mail.gmail.com/
Also on:    postgresql.org/message-id/w2oca24673e1004201340p703b0121iaf852aa28695be65@mail.gmail.com

 · 

reply

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-performance@postgresql.org
  Cc: dcrooke@gmail.com, Kevin.Grittner@wicourts.gov, scott@richrelevance.com
  Subject: Re: SOLVED ... Re: Getting rid of a cursor from JDBC .... Re: [PERFORM] Re: HELP: How to tame the 8.3.x JDBC driver with a biq guery result set
  In-Reply-To: <w2oca24673e1004201340p703b0121iaf852aa28695be65@mail.gmail.com>
  References: <q2sca24673e1004191633j10b1124amf1eb51f3bd84f19a@mail.gmail.com> <4BCD73AF0200002500030BC2@gw.wicourts.gov> <w2kca24673e1004200847k77429a1cra0a6f3560d407d8e@mail.gmail.com> <4BCD90D80200002500030BDD@gw.wicourts.gov> <x2zca24673e1004201229n653f4e69vd274af4a4aa22d09@mail.gmail.com> <4BCDC6B90200002500030C09@gw.wicourts.gov> <w2oca24673e1004201340p703b0121iaf852aa28695be65@mail.gmail.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