Re: How to use index in WHERE int = float

Поиск
Список
Период
Сортировка
От Andrus
Тема Re: How to use index in WHERE int = float
Дата
Msg-id 8AF3AFF2E5824671853122F2A1C7752B@andrusnotebook
обсуждение исходный текст
Ответ на Re: How to use index in WHERE int = float  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Ori Garin"
Дата:
Сообщение: Postgres dies on standby server after triggering failover
Следующее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: psql exit code