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 1gKkx4-0007x9-VH for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Nov 2018 14:06:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gKkx1-0003jr-JC for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Nov 2018 14:06:27 +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 1gKkx1-0003fi-BX for pgsql-hackers@lists.postgresql.org; Thu, 08 Nov 2018 14:06:27 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gKkwr-0006oG-0l for pgsql-hackers@lists.postgresql.org; Thu, 08 Nov 2018 14:06:26 +0000 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 0CDC448D34; Thu, 8 Nov 2018 15:06:16 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id lrhkOoLP0mc9; Thu, 8 Nov 2018 15:06:14 +0100 (CET) From: Antonin Houska To: Aleksandr Parfenov cc: a.bykov@postgrespro.ru, pgsql-hackers@lists.postgresql.org Subject: Re: Optimze usage of immutable functions as relation In-reply-to: References: <402356c32eeb93d4fed01f66d6c7fe2d@postgrespro.ru> <20180906185109.661aaef0@asp437-ThinkPad-L380> <153994199621.10161.17815885396545049364.pgcf@coridan.postgresql.org> Comments: In-reply-to Aleksandr Parfenov message dated "Sat, 20 Oct 2018 01:31:04 +0700." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 08 Nov 2018 15:08:03 +0100 Message-ID: <11120.1541686083@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Aleksandr Parfenov wrote: > I fixed a typo and some comments. Please find new version attached. I've checked this verstion too. * is_simple_stable_function() instead of fetching HeapTuple from the syscache manually, you might want to consider using functions from lsyscache.c (get_func_rettype, get_func_retse= t, etc.), or adding a function that returns (subset of) the fields you need in= a single call. * pull_up_simple_function(): As you assume that ret->functions is a single-item list Assert(list_length(rte->functions) =3D=3D 1); the following iteration is not necessary: foreach(lc, functions_list) Also, there seems to be a lot of copy & paste from pull_up_simple_values(),= so some refactoring would make sense. --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com