pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: James House <jhouse@part.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared Statements: Inefficient Type Conversion?
Date: Mon, 16 Apr 2007 15:29:27 -0400 (EDT)
Message-ID: <Pine.BSO.4.64.0704161525360.6935@leary.csoft.net> (raw)
In-Reply-To: <4623CCA0.305@part.net>
References: <46238730.6060903@part.net>
	<Pine.BSO.4.64.0704161250550.24838@leary.csoft.net>
	<4623CCA0.305@part.net>



On Mon, 16 Apr 2007, James House wrote:

>> You can try adding the url parameter stringtype=unspecified which will pass 
>> the String parameter untyped instead of as a String.
>
> FWIW, that didn't seem to make a difference - actually, it takes even longer 
> to execute. 
>

That's odd I was expecting to see something like this:

jurka=# CREATE TABLE test (a numeric);
CREATE TABLE
jurka=# CREATE INDEX test_idx_a ON test(a);
CREATE INDEX
jurka=# EXPLAIN SELECT * FROM test WHERE a = '1'::text;
                       QUERY PLAN
------------------------------------------------------
  Seq Scan on test  (cost=0.00..29.65 rows=7 width=32)
    Filter: ((a)::text = '1'::text)
(2 rows)

Get changed to something like this:

jurka=# EXPLAIN SELECT * FROM test WHERE a = '1'::unknown;
                                QUERY PLAN
-------------------------------------------------------------------------
  Bitmap Heap Scan on test  (cost=4.30..14.45 rows=7 width=32)
    Recheck Cond: (a = 1::numeric)
    ->  Bitmap Index Scan on test_idx_a  (cost=0.00..4.30 rows=7 width=0)
          Index Cond: (a = 1::numeric)
(4 rows)

Perhaps you have a JDBC driver that is too old to understand the 
stringtype URL parameter?  Looks like it is only available in 8.2 and on. 
So if you don't have an 8.2 driver it won't do anything.

Kris Jurka



view thread (5+ messages)  latest in thread

Message-ID: <Pine.BSO.4.64.0704161525360.6935@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0704161525360.6935@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0704161525360.6935@leary.csoft.net

 · 

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: books@ejurka.com, jhouse@part.net
  Subject: Re: Prepared Statements: Inefficient Type Conversion?
  In-Reply-To: <Pine.BSO.4.64.0704161525360.6935@leary.csoft.net>
  References: <46238730.6060903@part.net> <Pine.BSO.4.64.0704161250550.24838@leary.csoft.net> <4623CCA0.305@part.net> <Pine.BSO.4.64.0704161525360.6935@leary.csoft.net>

* 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