Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9nq1-00074A-US for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Nov 2017 07:53:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9nq1-0004qU-BJ for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Nov 2017 07:53:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9noT-00029b-Ka for pgsql-hackers@postgresql.org; Wed, 01 Nov 2017 07:51:49 +0000 Received: from www4.webmail.pair.com ([66.39.3.58]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9noL-0003xe-Kg for pgsql-hackers@postgresql.org; Wed, 01 Nov 2017 07:51:48 +0000 Received: by www4.webmail.pair.com (Postfix, from userid 65534) id D6780B426C5; Wed, 1 Nov 2017 03:51:38 -0400 (EDT) Received: from 84.44.209.80 ([84.44.209.80]) (SquirrelMail authenticated user te_123@bloodgate.com) by sm.webmail.pair.com with HTTP; Wed, 1 Nov 2017 03:51:38 -0400 Message-ID: <61b0807a4afa2bc3f421c0fd5959e0a1.squirrel@sm.webmail.pair.com> In-Reply-To: References: <20968.1509486337@sss.pgh.pa.us> <0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com> Date: Wed, 1 Nov 2017 03:51:38 -0400 Subject: Re: Account for cost and selectivity of HAVING quals From: "Tels" To: "David G. Johnston" Cc: "Tom Lane" , "pgsql-hackers@postgresql.org" User-Agent: SquirrelMail/1.4.23 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hello David, On Tue, October 31, 2017 7:54 pm, David G. Johnston wrote: > On Tue, Oct 31, 2017 at 4:31 PM, Tels > wrote: > >> >> ​​ >> That looks odd to me, it first uses output_tuples in a formula, then >> overwrites the value with a new value. Should these lines be swapped? >> > > ​IIUC it is correct: the additional total_cost comes from processing every > output group to check whether it is qualified - since every group is > checked the incoming output_tuples from the prior grouping is used. The > side-effect of the effort is that the number of output_tuples has now been > reduced to only those matching the qual - and so it now must take on a new > value to represent this. Ah, makes sense. Learned something new today. Maybe it's worth to add a comment, or would everybody else beside me understand it easily by looking at the code? :) Thank you, Tels -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers