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.
"Andrus" <[EMAIL PROTECTED]> writes:
>> The IN-pullup code runs before constant-simplification does, so it
>> doesn't see that as a simple join condition.
> Seems serious design flaw.
> How to change expression parser so that contant parts of expressions are
> removed before IN-pullup?
It would
The IN-pullup code runs before constant-simplification does, so it
doesn't see that as a simple join condition.
Seems serious design flaw.
How to change expression parser so that contant parts of expressions are
removed before IN-pullup?
Andrus.
--
Sent via pgsql-general mailing list (pgs
On Thu, Nov 06, 2008 at 12:08:57AM +0200, Andrus wrote:
> >PG 8.3 would
> >even throw it out, unless dokumnr was explicitly cast to a float8 as
> >well.
>
> I tried in 8.3
>
> create temp table dok ( dokumnr serial primary key );
> select * from dok where dokumnr='1'::float8
>
> and this run wit
"Andrus" <[EMAIL PROTECTED]> writes:
> As you see simply removing constant expression
> '0' or
> produces different query plan which is much faster for large amoutnts of
> data.
The IN-pullup code runs before constant-simplification does, so it
doesn't see that as a simple join condition.
PG 8.3 would
even throw it out, unless dokumnr was explicitly cast to a float8 as
well.
I tried in 8.3
create temp table dok ( dokumnr serial primary key );
select * from dok where dokumnr='1'::float8
and this run without error.
So i do'nt understand how 8.3 throws out.
Andrus.
--
Sent via
Did you read what I wrote? Cause you just repeated it as an argument
against my point.
Lets re-visit the second issue in my reply.
I tried in 8.3
explain SELECT dokumnr
FROM DOK
where dokumnr IN (1227714)
AND
( '0' or
dokumnr IN (SELECT dokumnr FROM firma1.bilkaib )
)
"Inde
On Wed, Nov 05, 2008 at 11:42:12PM +0200, Andrus wrote:
> Scott Marlowe wrote:
> >You do realize that a float is not an exact number. What you and I
> >see as 1228137 might really be, internally, 1228136. ?
>
> My query contains
> '1228137'::float8
> I do'nt see
> 1228136.
explain analyze select * from firma2.dok where dokumnr='1228137'::float8
"Seq Scan on dok (cost=0.00..187766.23 rows=6255 width=1145) (actual
time=43168.460..43176.063 rows=1 loops=1)"
" Filter: ((dokumnr)::double precision = 1228137::double precision)"
"Total runtime: 43176.375 ms"
I've jus
On Wed, Nov 05, 2008 at 02:21:33PM -0700, Scott Marlowe wrote:
> On Wed, Nov 5, 2008 at 11:52 AM, Andrus <[EMAIL PROTECTED]> wrote:
> > explain analyze select * from firma2.dok where dokumnr='1228137'::float8
> >
> > How to force PostgreSql to speed up without changing query ?
>
> Stop trying to
On Wed, Nov 5, 2008 at 2:42 PM, Andrus <[EMAIL PROTECTED]> wrote:
>> Stop trying to compare exact and inexact types?
>>
>> You do realize that a float is not an exact number. What you and I
>> see as 1228137 might really be, internally, 1228136. ?
>> So it won't get an exact match.
Stop trying to compare exact and inexact types?
You do realize that a float is not an exact number. What you and I
see as 1228137 might really be, internally, 1228136. ?
So it won't get an exact match. What's wrong with trying to match to
an exact number instead?
My query cont
On Wed, Nov 5, 2008 at 11:52 AM, Andrus <[EMAIL PROTECTED]> wrote:
> I have table with index
>
> CREATE TABLE firma2.dok(
> ...
> dokumnr serial NOT NULL,
> ...
> CONSTRAINT dok_pkey PRIMARY KEY (dokumnr),
> ...
> );
>
> CREATE INDEX dok_dokumnr_idx
> ON firma2.dok
> USING btree
> (dokumnr);
>
On Wed, Nov 05, 2008 at 08:52:50PM +0200, Andrus wrote:
> explain analyze select * from firma2.dok where dokumnr='1228137'::float8
>
> "Seq Scan on dok (cost=0.00..187766.23 rows=6255 width=1145) (actual
> time=43168.460..43176.063 rows=1 loops=1)"
> " Filter: ((dokumnr)::double precision = 12
On Wed, Nov 05, 2008 at 08:52:50PM +0200, Andrus wrote:
> explain analyze select * from firma2.dok where dokumnr='1228137'::float8
>
> "Seq Scan on dok (cost=0.00..187766.23 rows=6255 width=1145) (actual
> time=43168.460..43176.063 rows=1 loops=1)"
> " Filter: ((dokumnr)::double precision = 12
15 matches
Mail list logo