From: | "Andrus" <kobruleht2(at)hot(dot)ee> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to use index in WHERE int = float |
Date: | 2008-11-10 09:02:28 |
Message-ID: | 8AF3AFF2E5824671853122F2A1C7752B@andrusnotebook |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Ori Garin | 2008-11-10 09:02:44 | Postgres dies on standby server after triggering failover |
Previous Message | Andreas Kraftl | 2008-11-10 08:14:21 | Re: Fulltext index |