Re: How to use index in WHERE int = float - Mailing list pgsql-general

From Andrus
Subject Re: How to use index in WHERE int = float
Date
Msg-id 8AF3AFF2E5824671853122F2A1C7752B@andrusnotebook
Whole thread Raw
In response to Re: How to use index in WHERE int = float  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> It would be far simpler to fix your query generator to not emit the
> useless "0 or".

I'm using ODBC  and npgsql drivers. Those drivers replace parameters
automatically.

E.q. for npgsql or every other ADO .NET I can write

"SELECT * FROM (:param1 OR (x IN SELECT y FROM z) AND :param2) ...

etc.

param1, param2, ..., paramn etc. are entered by user and passed to driver as
parameters.

Proposed solution requires:

1. Stop using this type parameter replacement. Write case statements for
every possible paramn combination in application code,
total n! case statements.

or

2. Create expression parser which understands syntax for every backend
version and simplifies expression as string before passing to backend.

> Even if we made the planner deal with that, the number of cycles it
> would expend to recover from the generator's stupidity would be several
> orders of magnitude higher than the number of cycles needed to not be so
> stupid.

Proposed solution requires re-writing ODBC and npgsql and possibly every
other driver to add expression parser and constant optimization to it in
client side.
This seems to be huge work and no one dbms does not implement this.
In this case every query is processed two times. I do'nt understand how this
takes less time that processing query once in backend.

Andrus.


pgsql-general by date:

Previous
From: "Ori Garin"
Date:
Subject: Postgres dies on standby server after triggering failover
Next
From: Ivan Sergio Borgonovo
Date:
Subject: psql exit code