X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6DB6BD1B4BE for ; Sun, 18 Apr 2004 23:16:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06866-01 for ; Sun, 18 Apr 2004 23:16:53 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A3D42D1B482 for ; Sun, 18 Apr 2004 23:16:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i3J2GrME013911; Sun, 18 Apr 2004 22:16:53 -0400 (EDT) To: Rod Taylor Cc: Markus Bertheau , Litao Wu , Postgresql Performance Subject: Re: sunquery and estimated rows In-reply-to: <1082331774.47576.136.camel@jester> References: <20040416214529.10468.qmail@web13125.mail.yahoo.com> <3802.1082159101@sss.pgh.pa.us> <1082316145.2191.0.camel@yarrow.bertheau.de> <12050.1082329766@sss.pgh.pa.us> <1082331774.47576.136.camel@jester> Comments: In-reply-to Rod Taylor message dated "Sun, 18 Apr 2004 19:42:55 -0400" Date: Sun, 18 Apr 2004 22:16:53 -0400 Message-ID: <13910.1082341013@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/254 X-Sequence-Number: 6554 Rod Taylor writes: >> It's the only way to prevent it from simplifying when you don't want it >> to. > I'm having a difficult time coming up with a circumstance where that is > beneficial except when stats are out of whack. Try trawling the archives --- I recall several cases in which people were using sub-selects for this purpose. In any case, I don't see the value of having the planner check to see if a sub-select is just a trivial arithmetic expression. The cases where people write that and expect it to be simplified are so few and far between that I can't believe it'd be a good use of planner cycles. regards, tom lane