Skip site navigation (1) Skip section navigation (2)

Prepared statement not using an index

From: Guido Neitzer <guido(dot)neitzer(at)pharmaline(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Prepared statement not using an index
Date: 2005-09-01 22:11:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

I have an interesting problem with the JDBC drivers. When I use a  
select like this:

"SELECT t0.aktiv,, t0.ist_teilnehmer, t0.nachname, t0.plz,  
t0.vorname FROM public.dga_dienstleister t0 WHERE t0.plz  
like ?::varchar(256) ESCAPE '|'" withBindings: 1:"53111"(plz)>

the existing index on the plz column is not used.

When I the same select with a concrete value, the index IS used.

I use PostgreSQL 8.0.3 on Mac OS X and the JDBC driver 8.0-312 JDBC 3.

After a lot of other things, I tried using a 7.4 driver and with  
this, the index is used in both cases.

Why can this happen? Is there a setting I might have not seen?  
Something I do wrong?



pgsql-jdbc by date

Next:From: Dave HeldDate: 2005-09-01 22:17:54
Subject: Re: JDBC 8.0-310 + Crystal Reports 10 == Not Implemented
Previous:From: Dave HeldDate: 2005-09-01 20:05:35
Subject: RFP: Finish JDBC driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group