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 1rAz3D-008yzU-Nz for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 21:03:23 +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 1rAz3A-00CW8v-DJ for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 21:03:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAz3A-00CW8m-3x for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 21:03:20 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rAz36-00ARnQ-7B for pgsql-hackers@postgresql.org; Wed, 06 Dec 2023 21:03:19 +0000 Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-4258c2e2ee7so416761cf.2 for ; Wed, 06 Dec 2023 13:03:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1701896594; x=1702501394; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=/WOy6M9uLdq8qlmPvJEbrl6OElouaC/cocb7Lu2LP98=; b=R8Kz2hakkWoZlO8iuf4222mY/evvHHpyCZSJsXNiz64JEA0emOChTAoJ1kUo7v2BF/ 9PuSJljXDWuQbCprV3HbXzRJL9dqV0tMhQk/fyroBh3vtoilFXxx8ZNlx+bXSNzUdpif PJwturOXSST98bH35Fqav8ocjl5WtBvDoy9s3dSoc1VQM/wnt6CdfBeOmt2+iDONMdbC BeywhQdg65Wx/8fMGci6ANltFfPohKH0d8bt++cmLQ5u8F8Vo/dkfbfjp3q4OdO/Jt2j czWjW8YTwBSWkZmjgq/mBN72W7vkqCf9938o6VNXUGqyZkhCOTg3TVScwhmXA/QH9Ib2 gcuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701896594; x=1702501394; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/WOy6M9uLdq8qlmPvJEbrl6OElouaC/cocb7Lu2LP98=; b=WT0Rp+Zcavi+22e5TIgZZ78qnSARe6kIsACzTyUmZbPGbj8L+YtMl1Zl7T2xsiEo2N dT+KUPrFOe4NXbNCklTikLSqYIyMHQADtvDdmaVlQIPpNWK1W5EKvJwKHiqsiMrouBij kWISEKnpXPJt3ZDQ0eSVBs22O63mI4NWjEaFh8rtTq38R7GWIpZW8Zqipt6/9v0pqGWj x/79BCQbCVl3Tw3fy6DNuLYyVBj6+pgniTY+kgzc8820PnJesxGkFXt1qMzEyfCLxxAa Hxa6Zv+QToHE9WDceMnJ5o+L/p6rA2oBHuK35x4bk5cn3SchlgOvU903j3W49G1Y1Ion e38A== X-Gm-Message-State: AOJu0YwuXMeWswYHKNzrxLx9/a+XCZzkAHR8KlNqUckJrnXkCrnMgkEL Wyp6MmVTYln0mkv6uUGgNeo8Tw== X-Google-Smtp-Source: AGHT+IFWtJo0t21iTlim1mJPIPP4f3lu4A5MZbL7hnTiNH9IOkxon/lghWFkp/ezOJ7E2FP0ncZhJg== X-Received: by 2002:ac8:5a51:0:b0:425:4043:18c6 with SMTP id o17-20020ac85a51000000b00425404318c6mr1795086qta.121.1701896594338; Wed, 06 Dec 2023 13:03:14 -0800 (PST) Received: from ?IPV6:2605:a601:91bc:f600::2bb? ([2605:a601:91bc:f600::2bb]) by smtp.googlemail.com with ESMTPSA id t7-20020ac85307000000b00424046df696sm242202qtn.43.2023.12.06.13.03.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Dec 2023 13:03:13 -0800 (PST) Message-ID: <8724f1d2-d11c-aaf2-2cd3-3725e9441d1e@dunslane.net> Date: Wed, 6 Dec 2023 16:03:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US To: Tom Lane , Joe Conway Cc: Nathan Bossart , Davin Shearer , PostgreSQL-development References: <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> <1110690.1701880139@sss.pgh.pa.us> <20231206163349.GA2873889@nathanxps13> <20231206164439.GC2873889@nathanxps13> <77312d02-9325-4f14-9fe0-2746c2ee12bc@joeconway.com> <1136975.1701894046@sss.pgh.pa.us> From: Andrew Dunstan Subject: Re: Emitting JSON to file using COPY TO In-Reply-To: <1136975.1701894046@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-12-06 We 15:20, Tom Lane wrote: > Joe Conway writes: >> I'll see if I can add some caching to composite_to_json(), but based on >> the relative data size it does not sound like there is much performance >> left on the table to go after, no? > If Nathan's perf results hold up elsewhere, it seems like some > micro-optimization around the text-pushing (appendStringInfoString) > might be more useful than caching. The 7% spent in cache lookups > could be worth going after later, but it's not the top of the list. > > The output size difference does say that maybe we should pay some > attention to the nearby request to not always label every field. > Perhaps there should be an option for each row to transform to > a JSON array rather than an object? > > I doubt it. People who want this are likely to want pretty much what this patch is providing, not something they would have to transform in order to get it. If they want space-efficient data they won't really be wanting JSON. Maybe they want Protocol Buffers or something in that vein. I see there's  nearby proposal to make this area pluggable at cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com