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 1udEem-004xYU-Gn for pgsql-general@arkaria.postgresql.org; Sat, 19 Jul 2025 20:59:44 +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 1udEek-0085Jn-0K for pgsql-general@arkaria.postgresql.org; Sat, 19 Jul 2025 20:59:42 +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 1udEej-0085Je-4L for pgsql-general@lists.postgresql.org; Sat, 19 Jul 2025 20:59:41 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1udEeg-008B1a-2y for pgsql-general@lists.postgresql.org; Sat, 19 Jul 2025 20:59:40 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 066CA14000C6; Sat, 19 Jul 2025 16:59:38 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Sat, 19 Jul 2025 16:59:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1752958778; x=1753045178; bh=tCE8YxBvSdt0tFx4DqeI3w9JG/oNKvKnyMs0UrLtwZ4=; b= I9YJtrJhORy8Wg4tP44xUs5yht0b0uzR9EbYIzYVqGCZIUyb6MZH/ooQ0+3iNBc5 gbN5eXPTjGCtxv2jM+al3NYq6459h7FmVRRJQd6pEN2HO4cNsKZZVdRrDXsTCIAw KO6Z3LEFA36OOdOGY56poZKPl2i2eUY6Z6LEwIz+D1m8VY4vHK+mzvy8gg97eRKO trd9TPqfGM2MB4ic+JP9J6zCbMevdyZWY+ixEad3TrHhd+7ebrNPzsaC9A49abAR CroqBSs8pyj7Rkle5Ag/vN4sTjvliH6+4ywFlTjVzZLN9AOOJjEfip90Ci2CtR2s 0ZuP0DBdn9cdXLFAfmnMBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1752958778; x= 1753045178; bh=tCE8YxBvSdt0tFx4DqeI3w9JG/oNKvKnyMs0UrLtwZ4=; b=Z x83Ol5jo0Xi18Mgak+7De4K0R5fEqahpHgzNmVqh8vehAe27l0Ek+h+1E8GbDCS9 hj8YlMIUYs1EUMv14Tt0Y0XO0zWb3pAYrU3sEWBS4a7czOohP/PfOWCM+CBzpX8S zwJVqCb0Nl6BrJ4mxphzrPPWNeo0XC0l0dsOylrHXQ5vM8TBUQ/KYuXSACqGeNZZ VMeo56ooxAFGBVEA2wQtb45LliMbyU44AkClFqOed4Hyi3PEfKqJ6REvcR9LXRu2 TdrhJt0F4u16nHplKnexMmeslXdDEfybNSk0L40V75rogGcHGhb94DoQ4+bcTyvn wJb2rWf05dDo71gE/u6NQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeijeefhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghn ucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqe enucggtffrrghtthgvrhhnpeeujeffvefgtdehudefgffgudefgedthefftdfgveejfeel gfeigfdtgeffjefgvdenucffohhmrghinhepuggsfhhiuggulhgvrdhukhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopeegpdhmohguvgepsh hmthhpohhuthdprhgtphhtthhopehvvggvmhgrtddttddtsehgmhgrihhlrdgtohhmpdhr tghpthhtohepmhhmohhntghurhgvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggrvh hiugdrghdrjhhohhhnshhtohhnsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhq lhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 19 Jul 2025 16:59:36 -0400 (EDT) Message-ID: <289f005c-4a80-4098-bf58-f53e06bb7f8c@aklaver.com> Date: Sat, 19 Jul 2025 13:59:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Performance of JSON type in postgres To: veem v , Merlin Moncure , "David G. Johnston" Cc: pgsql-general References: <8efa554c-ba95-43d5-953c-def0d53dca9e@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: 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 7/19/25 13:39, veem v wrote: > > Thank you. > > I tested below for sample data. I see loading or serialization seems a > lot slower(twice as slower) in JSONB as compared to JSON. Whereas > storage looks efficient in JSONB. and reading performance of nested > fields are 7-8 times slower in JSON as compared to JSONB(and ofcourse > index support makes it a better choice here). Hope i am testing it > correctly here. > > https://dbfiddle.uk/6P7sjL22 > > So I am a bit confused here . Also one of our use caseĀ is, along with > persisting this data and querying it in postgres database, We are also > going to move this data from postgres (which is a upstream OLTP system) > to a downstream OLAP system ,which is in Snowflake database which is > having data types like Variant or Varchar types. So, will it create a > significant difference if we store it in JSON vs JSONB in our postgres > i.e the source/upstream database? I thought you are answered that with your tests above? At least for the Postgres end. As to the Snowflake end you will need to do comparable tests for fetching the data from Postgres and transforming it. -- Adrian Klaver adrian.klaver@aklaver.com