pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <maillist@candle.pha.pa.us>
Cc: secret <secret@kearneydev.com>
Cc: PG-SQL <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] Simple Optimization Problem
Date: Mon, 10 May 1999 12:29:26 -0400
Message-ID: <7551.926353766@sss.pgh.pa.us> (raw)
In-Reply-To: <199905100431.AAA23261@candle.pha.pa.us>

Bruce Momjian <maillist@candle.pha.pa.us> writes:
> I have added this to our TODO list as:
> 	process const=const parts of OR clause first 

I think that would be quite the wrong way to approach it.  What we
need is a general-purpose rewriter phase that tries to evaluate
constant subexpressions, and is applied after the rest of rewrite
but before planner/optimizer.  In this case

	select * from po where (po_id=8888 or 0=8888);

would be reduced to

	select * from po where (po_id=8888 or FALSE);

and then

	select * from po where (po_id=8888);

which the optimizer knows what to do with.  (cnfify() does some of this
but not enough.)

>> Is there any hope in 6.5 of the optimizer
>> handling this better?

Not for 6.5.  6.6 or 6.7 maybe...

			regards, tom lane



view thread (3+ messages)

Message-ID: <7551.926353766@sss.pgh.pa.us>
Permalink:  ../7551.926353766@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7551.926353766@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, maillist@candle.pha.pa.us, secret@kearneydev.com
  Subject: Re: [SQL] Simple Optimization Problem
  In-Reply-To: <7551.926353766@sss.pgh.pa.us>
  References: <199905100431.AAA23261@candle.pha.pa.us> <7551.926353766@sss.pgh.pa.us>

* 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