Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id CEC149FB69A for ; Mon, 16 Apr 2007 16:30:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 11584-02 for ; Mon, 16 Apr 2007 16:29:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 65B859FB68B for ; Mon, 16 Apr 2007 16:29:28 -0300 (ADT) Received: (qmail 7186 invoked by uid 1112); 16 Apr 2007 19:29:27 -0000 Date: Mon, 16 Apr 2007 15:29:27 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: James House cc: pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements: Inefficient Type Conversion? In-Reply-To: <4623CCA0.305@part.net> Message-ID: References: <46238730.6060903@part.net> <4623CCA0.305@part.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/54 X-Sequence-Number: 16903 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