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 1udF9r-0053sJ-Sg for pgsql-general@arkaria.postgresql.org; Sat, 19 Jul 2025 21:31:52 +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 1udF9q-008FdO-7Z for pgsql-general@arkaria.postgresql.org; Sat, 19 Jul 2025 21:31:50 +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 1udF9p-008FdG-Mh for pgsql-general@lists.postgresql.org; Sat, 19 Jul 2025 21:31:49 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1udF9n-008BCe-2P for pgsql-general@lists.postgresql.org; Sat, 19 Jul 2025 21:31:48 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-41bc2668f85so1807593b6e.2 for ; Sat, 19 Jul 2025 14:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752960707; x=1753565507; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=O1W8irYCSm6YbBRcjUVLlUMLeoAXui4dUC1ev75Krko=; b=Yu0YniYafFYvU2qpQjtVmp6Nq0AZUWrrCFfIuWjF4He/eL5A5pOYEUDklVgb5EWiIn SffkssdH9ENWFqFw7nYcHm0GPonSzsR8Kf7DEa7QGEw5I6EWSv6q5wmOHPUNH+hbHuw8 uVl3O7kG/7j9TbzIar+IFaizf9H4CmMJes2aezTX2X+YDw6+Pfa8DujZ0hOhyDBU+Zmq mW7avjUWVNTR+upzT9XAEkBXIpQpB/PGzs8ugxjNHK4TeEE9x4SvSYtzEWbhsdVOAJ1y kF7Vsc9rxqiDvjPSG1VIWS87wJ7ncxBfIvhu0lyItfpnVgK9z5iwJfu5zPuBfM2QuLwx Le4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752960707; x=1753565507; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O1W8irYCSm6YbBRcjUVLlUMLeoAXui4dUC1ev75Krko=; b=XJJhf86lyW0wdmqfVXv/v/DUvCDLUgJe36gxX4LDc/5OV3g13n3FEJ2u8/q4PO9p0k 2EXLN3E4IT6x+nfZUlszRs9I4lYj15yCN0whoDNQzKo12QZeEYUUrhebiIbKNtTNxc/D umkZeqGLWwPR9FkrcXn/29+8oonjHQifj/ZSdwabEkXtl6n6WtbRgGme45PJAJGpbccO v4Ttq0aZWJ9E/Lfvo8Ery0xq9ouJujVpX6OhtMZpLw5zrXkNYEafiOymX2awKAj4Ybxf QstpAVNDKSUsuir8dTQQHHM9lZv4G7cClES86SEHinYA3MKZXOY04YzZSC42Rl+CdjlC ORgA== X-Gm-Message-State: AOJu0YzXSL2/4quFobc7s+RMU1T4Y+mGnCJ4AAe7w1QcfewzvXvlC9Zd JLRZrOcfpsDYN7d6Vyy4v5ELl+M1QInyTrb/j0rq1CU/S1P5u2gVUGMO1xexrXfkfH+mJ3OKgAq P1MExivrvy9cqskj82I0yMWUK1wXahHXAQQ== X-Gm-Gg: ASbGncuZUw/yBJ+14CpUyMMGycV/g+CuVm2RmJJhgoi72jbkv18eiUZn+C+jMFXXKJC ALujDoG1Y6OJo6XeqUKy/Z52svd5U2JFWHbK+8waoxW8H/klQ5ubOYAFEYhs/Dg9nRwwH85G+9M QlEO0az8Benz7zp5wzwSI7wwjj7SEeiuxjKxX0GOkXbA1A0q8XttUZmfETfECLFujS2mmab+OVN l2EZs0yUU1OoDbxqIwvpSuzJ5ZCBehu2ecOR1CWOA== X-Google-Smtp-Source: AGHT+IG4vK3sjoHM83+9yhfVyGKXR7OAtE0VN4HEuElm9YLM0MlPATytp5m97Um7U6Sqk6i0MsV+ckT7pugCS7jtj9Q= X-Received: by 2002:a05:6808:350b:b0:3f8:150b:f571 with SMTP id 5614622812f47-41d04d89df1mr10984085b6e.21.1752960706684; Sat, 19 Jul 2025 14:31:46 -0700 (PDT) MIME-Version: 1.0 References: <8efa554c-ba95-43d5-953c-def0d53dca9e@aklaver.com> <289f005c-4a80-4098-bf58-f53e06bb7f8c@aklaver.com> In-Reply-To: From: Ron Johnson Date: Sat, 19 Jul 2025 17:31:35 -0400 X-Gm-Features: Ac12FXxqfQjrN0U03Eyt-z2UqU9uo11SFFQekJM9WsrcdlqXKO0H724NsbjzYiM Message-ID: Subject: Re: Performance of JSON type in postgres To: pgsql-general Content-Type: multipart/alternative; boundary="0000000000003a31e6063a4ef83c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003a31e6063a4ef83c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jul 19, 2025 at 5:19=E2=80=AFPM veem v wrote: > > On Sun, 20 Jul 2025 at 02:29, Adrian Klaver > wrote: > >> On 7/19/25 13:39, veem v wrote: >> > >> >> 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. >> >> Thank you Adrian. > Yes will try to test the load from postgres to snowflake to see if any > specific format makes a difference in such a situation(mainly considering > JSONB seems postgres native only). > > Additionally I am unable to test upfront, but few teammates are saying > below. Are these really true? Wants to know from experts here, > > 1)The lack of detailed statistics on data distribution within JSONB > columns can hinder the query planner from making optimal choices, sometim= es > leading to slower execution or a reliance on sequential scans even when > indexes exist. Storing extensive or deeply nested structures within a > single JSONB document can lead to document bloat. > > 2)Loss of Formatting and Order: The binary format of JSONB doesn't > preserve the original order of keys, whitespace, or duplicate keys in the > JSON input. > > 3)Lack of Type Safety and Schema Enforcement: JSONB provides no inherent > schema or type validation. This means you can easily insert inconsistent > data types for the same key across different rows, making data management > and querying challenging. > > 4)No Native Foreign Key Support: You cannot directly define foreign key > constraints within a JSONB column to enforce referential integrity with > other tables. > The answer to all of these questions is: normalize your data structures. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000003a31e6063a4ef83c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Jul 19, 2025 at 5:19=E2=80=AFPM v= eem v <veema0000@gmail.com>= ; wrote:
On = Sun, 20 Jul 2025 at 02:29, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 7/19/25 13:39,= veem v wrote:
>

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.

Thank you Adrian.
Yes will try to test the load from= postgres to snowflake to see if any specific format makes a difference in = such a situation(mainly considering JSONB seems postgres native only).
Additionally I am unable to test upfront, but few teammates are saying= below. Are these really true? Wants to know from experts here,

1)Th= e lack of detailed statistics on data distribution within JSONB columns can= hinder the query planner from making optimal choices, sometimes leading to= slower execution or a reliance on sequential scans even when indexes exist= . Storing extensive or deeply nested structures within a single JSONB docum= ent can lead to document bloat.

2)Loss of Formatting and Order:=C2= =A0The binary format of JSONB doesn't preserve the original order of ke= ys, whitespace, or duplicate keys in the JSON input.

3)Lack of Type = Safety and Schema Enforcement:=C2=A0JSONB provides no inherent schema or ty= pe validation. This means you can easily insert inconsistent data types for= the same key across different rows, making data management and querying ch= allenging.

4)No Native Foreign Key Support:=C2=A0You cannot directly= define foreign key constraints within a JSONB column to enforce referentia= l integrity with other tables.
=C2=A0
The answer to all of these questions is: normalize your data struct= ures.

-- =
Death to &l= t;Redacted>, and butter sauce.
Don't boil me, I'm still aliv= e.
<Redacted> lobster!
--0000000000003a31e6063a4ef83c--