Guido Neitzer wrote:
> I have an interesting problem with the JDBC drivers. When I use a
> select like this: [...]
> the existing index on the plz column is not used.
>
> When I the same select with a concrete value, the index IS used.
You should probably ask this on the pgsql-performance list.
> 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.
The 8.0 drivers pass parameters individually to the backend (analogous
to using PREPARE/EXECUTE), while the 7.4 drivers do textual substitution
into the query text. This can result in different query plans as you've
discovered.
-O