pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgres 9.0.4 with Serverside PreparedStatements never returns with large tables
2+ messages / 2 participants
[nested] [flat]
* Postgres 9.0.4 with Serverside PreparedStatements never returns with large tables
@ 2014-02-12 08:10 Mike O <mcanix@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Mike O @ 2014-02-12 08:10 UTC (permalink / raw)
To: pgsql-jdbc
All,
I've experienced a problem with the following conditions:
PostgreSQL Server 9.0.4 (fine on 9.1.10)
JDBC (Any version)
Serverside prepared statements (prepareThreshold=1)
A very large table (30,000,000+ rows) with indexes on int columns
Java (any version)
The problem is that the serverside prepared statement doesn't return in good time when querying a large table.
<massive_assumption> It seems that the serverside prepared statement tries to do something fancy around the parameterised arguments type inference and casts the arguments as text or varchar which results in the query not returning on time because it's using a seqscan rather than an index scan. </massive_assumption>
If I set the protocolVersion = 2 then it works fine (assuming I pass ints to the setObject or setInt functions)
I've tried the following connection parameters (in different configurations) which didn't work:
prepareThreshold=1
stringType=unspecified
protocolVersion=3
The following connection parameters worked (either/or):
prepareThreshold=0
protocolVersion=2
Can anyone confirm or deny this bug/issue/feature?
I've attached a test class - adjust the query and comment out the properties as you see fit (Obviously the large data set is going to be a problem).
Kind regards,
Mike O'Connell
--
If you don't know where you are going, any road will get you there.
Attachments:
DBTest.java (application/octet-stream, 3.3K) download
signature.asc (application/pgp-signature, 454B) download
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Postgres 9.0.4 with Serverside PreparedStatements never returns with large tables
@ 2014-02-12 16:18 Dave Cramer <pg@fastcrypt.com>
parent: Mike O <mcanix@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Cramer @ 2014-02-12 16:18 UTC (permalink / raw)
To: Mike O <mcanix@gmail.com>; +Cc: pgsql-jdbc
Yup,
Known issue. 9.1 fixed the problem.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Wed, Feb 12, 2014 at 3:10 AM, Mike O <mcanix@gmail.com> wrote:
> All,
>
> I've experienced a problem with the following conditions:
>
>
> 1. PostgreSQL Server 9.0.4 (fine on 9.1.10)
> 2. JDBC (Any version)
> 3. Serverside prepared statements (prepareThreshold=1)
> 4. A very large table (30,000,000+ rows) with indexes on int columns
> 5. Java (any version)
>
>
> The problem is that the serverside prepared statement doesn't return in
> good time when querying a large table.
>
> <massive_assumption> It seems that the serverside prepared statement tries
> to do something fancy around the parameterised arguments type inference and
> casts the arguments as text or varchar which results in the query not
> returning on time because it's using a seqscan rather than an index scan.
> </massive_assumption>
>
> If I set the protocolVersion = 2 then it works fine (assuming I pass ints
> to the setObject or setInt functions)
>
> I've tried the following connection parameters (in different
> configurations) which didn't work:
>
>
> 1. prepareThreshold=1
> 2. stringType=unspecified
> 3. protocolVersion=3
>
>
> The following connection parameters worked (either/or):
>
>
> 1. prepareThreshold=0
> 2. protocolVersion=2
>
>
> Can anyone confirm or deny this bug/issue/feature?
>
> I've attached a test class - adjust the query and comment out the
> properties as you see fit (Obviously the large data set is going to be a
> problem).
>
> Kind regards,
>
> Mike O'Connell
>
> --
>
> If you don't know where you are going, any road will get you there.
>
>
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2014-02-12 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 08:10 Postgres 9.0.4 with Serverside PreparedStatements never returns with large tables Mike O <mcanix@gmail.com>
2014-02-12 16:18 ` Dave Cramer <pg@fastcrypt.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