Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.3/8.9.3) with ESMTP id MAA52564 for ; Mon, 10 May 1999 12:30:47 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id MAA07553; Mon, 10 May 1999 12:29:26 -0400 (EDT) To: Bruce Momjian cc: secret , PG-SQL Subject: Re: [SQL] Simple Optimization Problem In-reply-to: Your message of Mon, 10 May 1999 00:31:48 -0400 (EDT) <199905100431.AAA23261@candle.pha.pa.us> Date: Mon, 10 May 1999 12:29:26 -0400 Message-ID: <7551.926353766@sss.pgh.pa.us> From: Tom Lane Bruce Momjian 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