Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAunr-008ifP-J3 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 16:31:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rAunp-00BLbL-VC for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 16:31:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAulk-00BHD4-2J for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 16:29:04 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAulh-0096hg-TO for pgsql-hackers@postgresql.org; Wed, 06 Dec 2023 16:29:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3B6GSxgn1110691; Wed, 6 Dec 2023 11:28:59 -0500 From: Tom Lane To: Andrew Dunstan cc: Joe Conway , Davin Shearer , PostgreSQL-development Subject: Re: Emitting JSON to file using COPY TO In-reply-to: <19a5f9d8-bd1f-9e51-0f5b-510c1189a8a7@dunslane.net> References: <5c84b70b-ba18-c45d-dbbe-612fa229b2ce@dunslane.net> <398c22f6-4299-4b17-80bf-2f14f4afd592@joeconway.com> <46cc4507-a0d9-4044-b2ce-5a8bca8015c0@joeconway.com> <2554e520-e103-8978-dcb5-807dfeb77402@dunslane.net> <926ff917-8371-40ec-b5e6-ab7b0e09bdc5@joeconway.com> <315b81d4-4b67-7828-0355-3808cd14acd1@dunslane.net> <7a60faf6-e7f1-419d-aee6-10a78ea2fe81@joeconway.com> <2e7ff718-895d-83fc-46f7-be25e23b23b4@dunslane.net> <1104915.1701877459@sss.pgh.pa.us> <19a5f9d8-bd1f-9! e51-0f5b-510c1189a8a7@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Wed, 06 Dec 2023 11:19:54 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1110689.1701880139.1@sss.pgh.pa.us> Date: Wed, 06 Dec 2023 11:28:59 -0500 Message-ID: <1110690.1701880139@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > On 2023-12-06 We 10:44, Tom Lane wrote: >> In particular, has anyone done any performance testing? >> I'm concerned about that because composite_to_json() has >> zero capability to cache any metadata across calls, meaning >> there is going to be a large amount of duplicated work >> per row. > Yeah, that's hard to deal with, too, as it can be called recursively. Right. On the plus side, if we did improve this it would presumably also benefit other callers of composite_to_json[b]. > OTOH I'd rather have a version of this that worked slowly than none at all. It might be acceptable to plan on improving the performance later, depending on just how bad it is now. regards, tom lane