Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiLYz-0007R3-3G for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jul 2018 15:18:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiLYx-0001GX-ID for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jul 2018 15:18:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiLYx-0001GQ-7p for pgsql-hackers@lists.postgresql.org; Wed, 25 Jul 2018 15:18:51 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiLYt-0004Kt-UP for pgsql-hackers@postgresql.org; Wed, 25 Jul 2018 15:18:50 +0000 Received: from [192.168.127.1] (port=26185 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1fiLYp-000Ex9-Es; Wed, 25 Jul 2018 15:18:43 +0000 Received: from [127.0.0.1] (port=25897 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fiLYo-000JJI-MK; Wed, 25 Jul 2018 15:18:42 +0000 From: Andrew Gierth To: David Fetter Cc: pgsql-hackers@postgresql.org Subject: Re: Early WIP/PoC for inlining CTEs In-Reply-To: <20180725054236.GB17411@fetter.org> (David Fetter's message of "Wed, 25 Jul 2018 07:42:37 +0200") Message-ID: <87bmavfjhy.fsf@news-spur.riddles.org.uk> References: <87sh48ffhb.fsf@news-spur.riddles.org.uk> <20180725054236.GB17411@fetter.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Wed, 25 Jul 2018 16:18:42 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "David" == David Fetter writes: David> Please find attached a version rebased atop 167075be3ab1547e18 David> with what I believe are appropriate changes to regression test David> output. The other changes to the regression tests output are David> somewhat puzzling, as they change the actual results of queries. Both of those changes are the result of volatile CTEs being inlined more than once (in one case, as part of an explicit test to ensure that CTEs are being materialized and not multiply evaluated). If you look for the XXX comment in the patch, it should be easy to add a check that skips inlining if cterefcount > 1 and contains_volatile_functions is true. -- Andrew (irc:RhodiumToad)