From: Patrik Kudo <kudo@partitur.se>
To: Jan Wieck <jwieck@debis.com>
Cc: maillist@candle.pha.pa.us
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Good Optimization
Date: Thu, 08 Jul 1999 11:23:14 +0200
Message-ID: <37846E02.CB83939C@partitur.se> (raw)
References: <m112A6U-0003ktC@orion.SAPserv.Hamburg.dsh.de>
Jan Wieck wrote:
>
> >
> > Bruce Momjian wrote:
> > >=20
> > > Added to TODO:
> > >=20
> > > * In WHERE x=3D3 AND x=3Dy, add y=3D3
> >
> > I don't know if I'm way off, but wouldn't removing "x=3Dy" improve
> > performance further?
>
> Maybe in the simple case above. But it will probably change
> the result set if someone issues
>
> SELECT a.x, b.y FROM a, b WHERE a.x >= 10
> AND a.x <= 19
> AND a.x = b.x;
>
> which should then get rewritten into
>
> SELECT a.x, b.y FROM a, b WHERE a.x >= 10
> AND a.x <= 19
> AND a.x = b.x
> AND b.x >= 10
> AND b.x <= 19;
>
> This time the "a.x = b.x" is important!
Ouch... didn't think that far. However, if an cache is implemented
it might be worth the extra overhead to optimize special cases like
the one I commented on. Since most systems use a fairly limited set
of queries (I suppose...) most of the queries will be cached quite
fast.
BTW, I just love the work all of you are doing! Postgres is awsome!
/Kudo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: kudo@partitur.se, jwieck@debis.com, maillist@candle.pha.pa.us
Subject: Re: [SQL] Good Optimization
In-Reply-To: <37846E02.CB83939C@partitur.se>
References: <m112A6U-0003ktC@orion.SAPserv.Hamburg.dsh.de> <37846E02.CB83939C@partitur.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox