pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Віталій Тимчишин <tivv00@gmail.com>
To: Brett Henderson <brett@bretth.com>
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared Statement Query Planning
Date: Sat, 29 Aug 2009 21:05:27 +0300
Message-ID: <331e40660908291105m5166f9b8j58bfc2fe6584d57b@mail.gmail.com> (raw)
In-Reply-To: <4A9921C4.30907@bretth.com>
References: <4A9892E5.4010509@bretth.com>
	<4A98ED05.6090302@opencloud.com>
	<4A9921C4.30907@bretth.com>

2009/8/29 Brett Henderson <brett@bretth.com>

> Oliver Jowett wrote:
>
>> Brett Henderson wrote:
>>
>> It looks like you're using setFetchSize(). That forces use of a named
>> statement regardless of prepareThreshold (we have to keep the statement and
>> corresponding portal alive so we can do subsequent fetches, even if there
>> are some other intervening queries, so we can't use the unnamed statement)
>>
> Yes, I'm currently using a fetch size of 10000.  I can't allow all results
> to be read at once because there can potentially be a huge number of results
> in the queries.  I've just tested it out, and sure enough leaving the fetch
> size at 0 prevents the use of named statements.
>

How about "create or replace temp view tmp_v as <query>" without
setFetchSize and then "select * from tmp_v" with setFetchSize? Not sure
still if DDL can use prepared query parameters.
Another options would be either to use protocolLevel=2 (writing from memory,
may misspell parameter name) - this will force client-side parameter
embedding or to embed your timestamps into query text by yourself and not to
use PreparedStatement at all. Fortunatelly this are not strings - so no
quoting needed.

Best regards, Vitalii Tymchyshyn

view thread (9+ messages)  latest in thread

Message-ID: <331e40660908291105m5166f9b8j58bfc2fe6584d57b@mail.gmail.com>
Permalink:  ../331e40660908291105m5166f9b8j58bfc2fe6584d57b@mail.gmail.com/
Also on:    postgresql.org/message-id/331e40660908291105m5166f9b8j58bfc2fe6584d57b@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-jdbc@postgresql.org
  Cc: tivv00@gmail.com, brett@bretth.com, oliver@opencloud.com
  Subject: Re: Prepared Statement Query Planning
  In-Reply-To: <331e40660908291105m5166f9b8j58bfc2fe6584d57b@mail.gmail.com>
  References: <4A9892E5.4010509@bretth.com> <4A98ED05.6090302@opencloud.com> <4A9921C4.30907@bretth.com> <331e40660908291105m5166f9b8j58bfc2fe6584d57b@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