Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5eSo-0005bW-Rd for pgsql-performance@arkaria.postgresql.org; Sat, 12 Nov 2016 19:59:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c5eSo-0003FQ-A8 for pgsql-performance@arkaria.postgresql.org; Sat, 12 Nov 2016 19:59:46 +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 1c5eSn-0003EU-2B for pgsql-performance@postgresql.org; Sat, 12 Nov 2016 19:59:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c5eSk-00031t-3o for pgsql-performance@postgresql.org; Sat, 12 Nov 2016 19:59:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uACJxWoR002804; Sat, 12 Nov 2016 14:59:32 -0500 From: Tom Lane To: "ldh@laurent-hasson.com" cc: Marc Mamin , "pgsql-performance@postgresql.org" Subject: Re: Inlining of functions (doing LIKE on an array) In-reply-to: <35BE9BD1DD4DD444B0EDE3721E2AEA860115DECB@P3PWEX4MB001.ex4.secureserver.net> References: <35BE9BD1DD4DD444B0EDE3721E2AEA860115CB08@P3PWEX4MB001.ex4.secureserver.net> <35BE9BD1DD4DD444B0EDE3721E2AEA860115D550@P3PWEX4MB001.ex4.secureserver.net> <29682.1478882784@sss.pgh.pa.us> <35BE9BD1DD4DD444B0EDE3721E2AEA860115DECB@P3PWEX4MB001.ex4.secureserver.net> Comments: In-reply-to "ldh@laurent-hasson.com" message dated "Sat, 12 Nov 2016 00:41:16 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2794.1478980772.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 12 Nov 2016 14:59:32 -0500 Message-ID: <2795.1478980772@sss.pgh.pa.us> X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org "ldh@laurent-hasson.com" writes: > I wish there were a way to force inlining, or some other mechanism as the= performance difference is large here. I'll be using the inlining approach = when possible, but the SQL Function approach is simpler and will likely be = more suitable for some developers. I'm not sure that there's any fundamental reason why we don't inline SQL functions containing sub-selects. It may just be not having wanted to put any effort into the case way-back-when. Inlining happens too late to allow a resulting WHERE EXISTS to get mutated into a semijoin, but in this example that couldn't happen anyway, so it's not much of an objection. regards, tom lane --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance