Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krOJh-0004lX-Ll for pgsql-general@arkaria.postgresql.org; Mon, 21 Dec 2020 16:45:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krOJg-00037W-Bh for pgsql-general@arkaria.postgresql.org; Mon, 21 Dec 2020 16:45:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krOJf-00037P-VP for pgsql-general@lists.postgresql.org; Mon, 21 Dec 2020 16:45:48 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1krOJd-0005Wg-6e for pgsql-general@postgresql.org; Mon, 21 Dec 2020 16:45:46 +0000 Received: by mail-qt1-x836.google.com with SMTP id z9so6999425qtn.4 for ; Mon, 21 Dec 2020 08:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=americanefficient-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=A3udP1s5v8xm1IOTOU1SwFmCcxPv2MBpJ2pzqn8EFLM=; b=jvAf05Qin33nZxeqW+kARblE4U41Ov+ZkpVYcGuVaPhxZihbLYEBjTaoX33srhDhpd MVlI3QCJOHcsHdACFrgRvE87erkM1sIRg0iLfTi1V13lwwMVST6+54tTHrvUtdlPvikI /NM49Q4UUtENZzMCVNKqYXSZ1/p1e946v83vBrfArEAxZ+ZAhRN5wXpKs6fPb50YuD5F jgTS+xlRcUhjlEDwaSEtRNJyB6nzixP1+KQoktXBEDGg2cTNrEIkoQ6Llm1GpHK1yaPG vRwriHhAOMPTTf9M0JoInOm8cbWkiDLiGjf9G3+NPIin7HOsKE4CSddDWxUugnSblgf6 qkTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=A3udP1s5v8xm1IOTOU1SwFmCcxPv2MBpJ2pzqn8EFLM=; b=tqRQ0tN/N4B6Zbj+wbsta9sBsi6rU5ibZuzPyvjxuHAwDV+YqQfFob4k9gVeQQboZL v7dKx1DRrreMluBimYEJNwA0RGCeEjZrhuF1LmXcy7TPw7US1qvUAQejK91EgrwTj1Ey b6/jtkCYoNfNiSKIA3jEvzjKdszlSYornOt4tw331eebiwaIFu3LPtCJzbhvlMjOxz1u BGUGx3UX76YfRb5S5J8auqu+dgn5wVuroO1aS4LgAKQeDnYLgIFquaUjf46yC+WhoVIh sd5YjDukc0Wtokdkmx4O1fLVX+yU6NJNS4IC8ihqXZF34ArvD+1nVnl+dVjsx35ds5HS IY+A== X-Gm-Message-State: AOAM530YkZJYQ6RWLxFblMnYYx+qZo+DBS271+KnG0eDwCvmldk6muqP +18IZy4Xqcrelf0fDkFGn6dSpf5+IpyHqA== X-Google-Smtp-Source: ABdhPJzt/8cNmqPk3lkgNUxM/pgDjCyKWV2hdXFdm4Dox/HNzxUv8SFn7z74ZU/OUwBwZx2PeizE1w== X-Received: by 2002:ac8:4c8c:: with SMTP id j12mr17260338qtv.133.1608569143654; Mon, 21 Dec 2020 08:45:43 -0800 (PST) Received: from [10.0.1.10] (user-10lff1p.cable.mindspring.com. [65.87.188.57]) by smtp.gmail.com with ESMTPSA id u7sm11387607qke.116.2020.12.21.08.45.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:45:42 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: Avoid excessive inlining? From: Philip Semanchuk In-Reply-To: Date: Mon, 21 Dec 2020 11:45:41 -0500 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Joel Jacobson X-Mailer: Apple Mail (2.3608.120.23.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Dec 19, 2020, at 12:59 AM, Joel Jacobson wrote: >=20 > Is there a way to avoid excessive inlining when writing pure SQL = functions, without having to use PL/pgSQL? Hi Joel, The rules for inlining are here: https://wiki.postgresql.org/wiki/Inlining_of_SQL_functions According to those rules, if you declared your SQL function as VOLATILE, = then Postgres wouldn=E2=80=99t inline it. =46rom your question, I=E2=80=99= m not sure if you want to have the same function inlined sometimes and = not others. I can=E2=80=99t think of a way to do that offhand. Hope this helps, Philip