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 1mKxFQ-0000HB-Vz for pgsql-performance@arkaria.postgresql.org; Tue, 31 Aug 2021 06:27:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKxFP-0001CH-Qs for pgsql-performance@arkaria.postgresql.org; Tue, 31 Aug 2021 06:27:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKxFP-0001C8-IR for pgsql-performance@lists.postgresql.org; Tue, 31 Aug 2021 06:27:51 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKxFM-00067D-Tq for pgsql-performance@postgresql.org; Tue, 31 Aug 2021 06:27:51 +0000 Received: from ANAT ([78.197.128.121]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.168]) with ESMTPSA (Nemesis) id 1MP2zs-1mdb5G2Nw4-00PMBQ; Tue, 31 Aug 2021 08:27:42 +0200 From: "Michel SALAIS" To: , "'Julien Rouhaud'" Cc: "'Tom Lane'" , "'Ranier Vilela'" , "'Andrew Dunstan'" , "'Justin Pryzby'" , References: <2092859.1629558281@sss.pgh.pa.us> <2136207.1629569846@sss.pgh.pa.us> <20210821191950.GW10479@telsasoft.com> <20210821221729.GY10479@telsasoft.com> <20210822154758.GZ10479@telsasoft.com> <30496.1629654632@sss.pgh.pa.us> <35729.1629660223@sss.pgh.pa.us> <846170.1630086205@sss.pgh.pa. us> <1050917.1630180243@sss.pgh.pa.us> <1124170.1630244105@sss.pgh.pa.us> <1177685.1630253948@sss.pgh.pa.us> In-Reply-To: Subject: RE: Big Performance drop of Exceptions in UDFs between V11.2 and 13.4 Date: Tue, 31 Aug 2021 08:27:40 +0200 Message-ID: <009201d79e31$4d86b960$e8942c20$@msym.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQM/eypU0Br0reo5v0VXOMbHFxNU6AIJTxxcANfbqHUBfNjjyQIqbaOhAliooL0DNe+d1wFGSpaQAvrYEQcBNcDQ1wHCbfpdAih9qK8B+iOrRAGaYjL0AW8txD0CwaXG3AD7SIlAAiwe7O8CbLuufwHiaplVAh02190CU9vrKgIN1farAnF7MNMB7inxegHezXMpAW6yPoYBzIvfkAGn1YFipwrBNyA= Content-Language: fr X-Provags-ID: V03:K1:n6pBnABNMCDUHvEXY7F/u9c+YkJ5vCNUat7Gk2npyIB5SP8ZwLl PeFJbj91JFPDy8JQNW45E95YUdq2OmHGW6tdR9G+MPrffx9dt5pn2YaYtXvlMZWjeZFSHS+ 10Bf0QvBpK8JCT6q6Oxluj9LyMxp/UJgnqweUepssMQNVwbOkY2HrcVW2cfyO2SzdY/21mo AQkHbeFQ4H70mENaOQLoQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:3LXNcJoHo6g=:DEVojguucM8dos3JUrd5yn bfQR5OAWsfbZlJP/rYJyZQH9lhorq1WzBwd1VjKEIR4MnsxCn/mnOzjVdM/vZ4cHzJ+sz3ZKS 3ROrsBjMcb6IrLxe1xbUNtGguW2UDXRfLks+pxHvQOvwzN+6sY0Rt8t/9c6i7jv8UegWl4ZAH gDcAB/mcYQYC9iYgFN8Jt7FruTeCHYZ+MpFZJcVhfqu/qpiYAXvcScp/EetIxzs/Ts2rgfGTC 9obarkUD39oNkKGfkUlBfXfDDC2SotjMx5YZwZCVcHhTCMVtw0HgVF/JA4IeRYGzMGUJ6mS8o ZwtLXyDpugltw36JpyuE7DcttnSf5x9KzCnVVB3j/50pGaUiPwgmC6KXfCALgggfYgi3777/R +p0OLYeT+W5Hx9iCJco7jZO3tltPN5PNo7L0fAi0sayGL09k8DZpxT/tMgB/VUdmI+3MQXDK5 vGFrQQiGFQgFO3YS8aOMxXMy/l+3gZjxcoDyP9buOnQiRHkpfVHAASvWhng1bgRQx08mkmG+Y w0MUyRsU3wmD7gEHAUe5GofpEbqq5w5nBDHIbl+hi8KzaUNK0Mqlv2nVPxV7FIhOpOJluAzZ+ +wqsluzvZN1pkUWKcx5aGiia/LHgLSrUZPSByBHOdrdHVQ9DJ6c9EjLR3hBz5AqjipfAMWtci ScqfCXTAT+YFumu7FODRuW+RGcLBiINYye6Y0+7RWTjc/BDfHkVzRgh7jcFjTgOmdEw/vQa+N J0dJHdScDaMjuWjjFla23R5Z2V+zEDh10Y57uQ== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk -----Message d'origine----- De : ldh@laurent-hasson.com =20 Envoy=C3=A9 : mardi 31 ao=C3=BBt 2021 04:18 =C3=80 : ldh@laurent-hasson.com; Julien Rouhaud Cc : Tom Lane ; Ranier Vilela ; = Andrew Dunstan ; Justin Pryzby = ; pgsql-performance@postgresql.org Objet : RE: Big Performance drop of Exceptions in UDFs between V11.2 and = 13.4 Importance : Haute > I see on https://www.postgresql.org/download/ that there is a = different > installer from 2ndQuadrant. I am going to try that one and see = what I > come up with. Are there any other "standard" distros of Postgres = that I > could try out? > =20 > I found out I could download Visual Studio community edition so I = am > trying this, but may not have the time to get through a build any = time > soon as per my unfamiliarity with the process. I'll follow = Ranier's steps > and see if that gets me somewhere. > =20 > Thank you, > Laurent. Hello all, I think I had a breakthrough. I tried to create a local build and wasn't = able to. But I downloaded the 2nd Quadrant installer and the issue = disappeared!!! I think this is proof that it's not my personal = environment, nor something intrinsic in the codebase, but definitely = something in the standard EDB installer. create table sampletest (a varchar, b varchar); insert into sampletest = (a, b) select substr(md5(random()::text), 0, 15), = (100000000*random())::integer::varchar from generate_series(1,100000); CREATE OR REPLACE FUNCTION toFloat(str varchar, val real) RETURNS real = AS $$ BEGIN RETURN case when str is null then val else str::real end; EXCEPTION = WHEN OTHERS THEN RETURN val; END; $$ LANGUAGE plpgsql COST 1 IMMUTABLE; explain (analyze,buffers,COSTS,TIMING) select MAX(toFloat(a, null)) as = "a" from sampletest; --Aggregate (cost=3D2137.00..2137.01 rows=3D1 = width=3D4) (actual time=3D2092.922..2092.923 rows=3D1 loops=3D1) -- Buffers: shared hit=3D637 -- -> Seq Scan on sampletest (cost=3D0.00..1637.00 rows=3D100000 = width=3D15) (actual time=3D0.028..23.925 rows=3D100000 loops=3D1) -- Buffers: shared hit=3D637 --Planning Time: 0.168 ms --Execution Time: 2092.957 ms explain (analyze,buffers,COSTS,TIMING) select MAX(toFloat(b, null)) as = "b" from sampletest; --Aggregate (cost=3D2137.00..2137.01 rows=3D1 = width=3D4) (actual time=3D369.475..369.476 rows=3D1 loops=3D1) -- Buffers: shared hit=3D637 -- -> Seq Scan on sampletest (cost=3D0.00..1637.00 rows=3D100000 = width=3D8) (actual time=3D0.020..18.746 rows=3D100000 loops=3D1) -- Buffers: shared hit=3D637 --Planning Time: 0.129 ms --Execution Time: 369.507 ms Thank you, Laurent! _________________________________________________________ Hi, Something which has nothing with the thread but I think it must be said = :-) Why substring(x, 0, ...)? msym=3D> select substr('abcde', 0, 3), substr('abcde', 1, 3); substr | substr --------+-------- ab | abc Michel SALAIS