Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erjtE-0004R6-QF for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Mar 2018 12:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erjtD-000596-9U for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Mar 2018 12:34:19 +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.89) (envelope-from ) id 1erjtC-00054a-VZ for pgsql-hackers@lists.postgresql.org; Fri, 02 Mar 2018 12:34:19 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erjt8-0000RJ-Lm for pgsql-hackers@postgresql.org; Fri, 02 Mar 2018 12:34:17 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 3695421CA13D; Fri, 2 Mar 2018 15:34:13 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id D911821CA138; Fri, 2 Mar 2018 15:34:12 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1519994053; bh=7lFEL7seNUxenChGvQJGkm3uUGcVXRKKkhGV8teQKpQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=kR//KtGOup3krcO7OBjjylN69VF2iN1tJNguiyroSGraOuqO9lmyEn/Uftu/gheqX NwJr9X4/LiWmEfChuDAOH8krfhbCPZ2qMTsAEdcL3+/0yTLOXggPuhJssggtYTNqQU 0Xq36UIXI2a64urCqB8bQ3c0f0LIJa5x3gVAdZxM= Subject: Re: [HACKERS] Surjective functional indexes To: Andres Freund Cc: Stephen Frost , Michael Paquier , Alvaro Herrera , Simon Riggs , Christoph Berg , Thomas Munro , Peter Eisentraut , PostgreSQL Hackers References: <20171214211553.ijxfd4p52nz7qg44@alvherre.pgsql> <623fdf0f-c3d1-7553-e784-f8d5a900239b@postgrespro.ru> <20180106225942.GT2416@tamriel.snowman.net> <40fd1ef1-6227-69d1-9a24-edfef875e006@postgrespro.ru> <20180301194824.46ivyszju2ivhlh5@alap3.anarazel.de> From: Konstantin Knizhnik Message-ID: Date: Fri, 2 Mar 2018 15:34:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180301194824.46ivyszju2ivhlh5@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 01.03.2018 22:48, Andres Freund wrote: > Hi, > > I still don't think, as commented upon by Tom and me upthread, that we > want this feature in the current form. > > Your arguments about layering violations seem to be counteracted by the > fact that ProjectionIsNotChanged() basically appears to do purely > executor work inside inside heapam.c. ProjectionIsNotChanged doesn't perform evaluation itslef, is calls FormIndexDatum. FormIndexDatum is also called in 13 other places in Postgres: analyze.c, constraint.c, index.c, tuplesort, execIndexing.c I still think that trying to store somewhere result odf index expression evaluation to be able to reuse in index update is not so good idea: it complicates code and add extra dependencies between different modules. And benefits of such optimization are not obvious: is index expression evaluation is so expensive, then recheck_on_update should be prohibited for such index at all. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company