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 1fn5IM-00077Q-N7 for pgsql-general@arkaria.postgresql.org; Tue, 07 Aug 2018 16:57:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fn5IL-0000M1-5l for pgsql-general@arkaria.postgresql.org; Tue, 07 Aug 2018 16:57:17 +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 1fn5IK-0000Lu-S0 for pgsql-general@lists.postgresql.org; Tue, 07 Aug 2018 16:57:16 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fn5IH-0003zP-0V for pgsql-general@postgresql.org; Tue, 07 Aug 2018 16:57:16 +0000 Received: by mail-pl0-x243.google.com with SMTP id b90-v6so6581010plb.0 for ; Tue, 07 Aug 2018 09:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:message-id:references:to; bh=thdjVT77PJqv7KEDBl5BTZKirLk7glU4Lpzb0RE/eVA=; b=g3mbnc5Xp8R6HowO3lB6AH2ltEuD1tX19QLl9yDluGuSUwK+6psbmVtLxhq6jjxDDI sSS0rTMKc5poyfFGB5AzKY/MZ7F+xmoHgQdkQI33Y2CIwczBm3YtD8iLcvTSb1xiu17Z 7GQCYsoFjtJmiDDeyDyXqKmO+hm4MC0/RsSVXmyKXWS6WaYMOzYEgH0CjyqmhWS4DF60 ej40FSJyZqAJ1E3Hot0WAAay2aHD6EXl6MJ7MSkLMdSDhMDqofy7SzfeESqLX2vEz8UX gyxZRsmS15qojTJQLs6ljvCmX0eX0z91xH/zLu9dTmObBC4XSJTG2TXWqweKlOpswKmz 0wCA== 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 :message-id:references:to; bh=thdjVT77PJqv7KEDBl5BTZKirLk7glU4Lpzb0RE/eVA=; b=V6Li5kId8fjcSsTRe7YJCGhar6PSMJGRveMb4Qxjsn9BuusVBUp3vUrow/+sxc4HQe zSaDMSUm1Ag/sWeqg37CxgBj+MkQDYumv7pgXyMAmIoBDIXYQuHQzs4rpEIHx9FWzE8G LEdOq0arwnbC3FRAwHSfPyPJ+iCXivjbAFOrvI+SxZTe35bGWit4pkP42tH9tIaLXBJX P7b3CqAT0EVr7j1vTISWeM8M1GbL7raXTN9eUUe/yJeQ0Nw4d6r3jLo5AqUjw+2weOx7 kAab7i/lNBq0oz01qCpDnCT1uLA0sVWUj96LkNlresGbDdPLLbqQsN9IEFKch+UjzZxW zpZw== X-Gm-Message-State: AOUpUlFZqq6RLOPCWZqdaxTusGtreMnw/pmwgVJBDdtf6x2kJZGWRGS4 pjY2nTQp5PtWXTGexHovJFmDVGLB X-Google-Smtp-Source: AAOMgpdh+JRmQ+0q7WEh+MwNgZiPRmKIHdFG5nH+4MgTGrO4RTPAyMKhjYfoX+1ixQFQ3CMWfLaSVA== X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr18263798plo.257.1533661030200; Tue, 07 Aug 2018 09:57:10 -0700 (PDT) Received: from ?IPv6:2600:8801:8800:1a::13? ([2600:8801:8800:1a::13]) by smtp.gmail.com with ESMTPSA id l85-v6sm3792252pfk.34.2018.08.07.09.57.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 09:57:09 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_7D2FFB9F-9BA1-4D5C-9C94-0FA35DA183E3" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Immutable function WAY slower than Stable function? From: Guyren Howe X-Mailbutler-Tracking-Uuid: B06605FB-812F-411E-A49B-39ACCF199395 In-Reply-To: <24954.1533658221@sss.pgh.pa.us> X-Mailbutler-Link-Tracking-Uuid: Date: Tue, 7 Aug 2018 09:57:15 -0700 Message-Id: <455A4B55-84BC-46A4-B1B7-F2F4246329A0@gmail.com> References: <03120a03-75d0-ad6c-691c-35ca7e7fccfa@aklaver.com> <27336.1533609731@sss.pgh.pa.us> <24954.1533658221@sss.pgh.pa.us> To: PG-General Mailing List X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_7D2FFB9F-9BA1-4D5C-9C94-0FA35DA183E3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Aug 7, 2018, at 9:10 , Tom Lane wrote: >=20 > I've had a to-do item to rewrite and improve the SQL function cache > mechanism for a long time, but I hadn't thought it was high priority. > Maybe it should be. Personally, I would love this. Far too few developers dig into doing = things in the database. Conceptually, doing all the data things in the = database should be faster, more versatile, more secure etc. Modern SQL has tools that can make its awfulness tolerable. CTEs and SQL = functions spring immediately to mind. But both suffer from optimization = fences and corner cases like this that arguably make it not worth the = effort. --Apple-Mail=_7D2FFB9F-9BA1-4D5C-9C94-0FA35DA183E3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii On = Aug 7, 2018, at 9:10 , Tom Lane <tgl@sss.pgh.pa.us> wrote:

I've had a = to-do item to rewrite and improve the SQL function cache
mechanism for a long time, but I = hadn't thought it was high priority.
Maybe it should be.

Personally, I would love this. Far too few = developers dig into doing things in the database. Conceptually, doing = all the data things in the database should be faster, more versatile, = more secure etc.

Modern SQL has tools that can make its awfulness tolerable. = CTEs and SQL functions spring immediately to mind. But both suffer from = optimization fences and corner cases like this that arguably make it not = worth the effort.
3D""= --Apple-Mail=_7D2FFB9F-9BA1-4D5C-9C94-0FA35DA183E3--