pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Andrew Dunstan <andrew@dunslane.net>
To: Davin Shearer <davin@apache.org>
To: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Subject: Re: Emitting JSON to file using COPY TO
Date: Sun, 3 Dec 2023 15:09:36 -0500
Message-ID: <cb63a985-35a5-4f1e-a551-32166e18112c@joeconway.com> (raw)
In-Reply-To: <6603ea04-8ec3-67b2-e9f6-e00fd0e46858@dunslane.net>
References: <CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU=kcg@mail.gmail.com>
	<fc1e39f8-274f-4be6-8a70-9fb0d9fe84a2@aklaver.com>
	<CAFCRh-_LhP5Ln4-beVz=1pQ9VycU3hAxnJHXhPHZRmX0BSCVEQ@mail.gmail.com>
	<CAFCRh--Vhx0105S7SWAYHGcVMTSRtbcoArDUGSbYSWRUGunW_g@mail.gmail.com>
	<CAKFQuwZb3zaSqkOvGXRRLZEW61az+4xyHZ7tBPR91JfrcdCKvA@mail.gmail.com>
	<3853387.1701096982@sss.pgh.pa.us>
	<CAFCRh-_GdiUvjd5z5FfvTfhruOnYqBu163XU47zZE8RNATCJGQ@mail.gmail.com>
	<3a98decf-3fe3-4b49-9b68-fda01338872c@sedlakovi.org>
	<CALvfUkCq3pvkmniWEKZwkbA6hNNvkANF3OamMfhC170RgY+HJg@mail.gmail.com>
	<24e3ee88-ec1e-421b-89ae-8a47ee0d2df1@joeconway.com>
	<b22367ef-6ac1-e1c0-da05-0e760e1b7e29@dunslane.net>
	<8c88da85-c197-4765-96f8-a9a1c78305a6@joeconway.com>
	<a70d33fb-76f8-40a8-9a5f-7e03b120e661@joeconway.com>
	<6603ea04-8ec3-67b2-e9f6-e00fd0e46858@dunslane.net>

On 12/3/23 14:52, Andrew Dunstan wrote:
> 
> On 2023-12-03 Su 14:24, Joe Conway wrote:
>> On 12/3/23 11:03, Joe Conway wrote:
>>> On 12/3/23 10:10, Andrew Dunstan wrote:
>>>> I  realize this is just a POC, but I'd prefer to see 
>>>> composite_to_json()
>>>> not exposed. You could use the already public datum_to_json() instead,
>>>> passing JSONTYPE_COMPOSITE and F_RECORD_OUT as the second and third
>>>> arguments.
>>>
>>> Ok, thanks, will do
>>
>> Just FYI, this change does loose some performance in my not massively 
>> scientific A/B/A test:
>>
>> 8<---------------------------
<snip>
>> 8<---------------------------
>>
>> That is somewhere in the 3% range.
> 
> I assume it's because datum_to_json() constructs a text value from which
> you then need to extract the cstring, whereas composite_to_json(), just
> gives you back the stringinfo. I guess that's a good enough reason to go
> with exposing composite_to_json().

Yeah, that was why I went that route in the first place. If you are good 
with it I will go back to that. The code is a bit simpler too.

-- 
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com






view thread (163+ messages)  latest in thread

Message-ID: <cb63a985-35a5-4f1e-a551-32166e18112c@joeconway.com>
Permalink:  ../cb63a985-35a5-4f1e-a551-32166e18112c@joeconway.com/
Also on:    postgresql.org/message-id/cb63a985-35a5-4f1e-a551-32166e18112c@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: mail@joeconway.com, andrew@dunslane.net, davin@apache.org, pgsql-hackers@postgreSQL.org
  Subject: Re: Emitting JSON to file using COPY TO
  In-Reply-To: <cb63a985-35a5-4f1e-a551-32166e18112c@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox