public inbox for [email protected]  
help / color / mirror / Atom feed
From: Divyansh Gupta JNsThMAudy <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Need help in database design
Date: Mon, 23 Dec 2024 22:37:20 +0530
Message-ID: <CAHesJ5+vu_HGNSwDGz4YdMyUb_Yq4oTuhKBzydutcUiG1ChOtA@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaBg5=iNXJDgk_saDD_nJAE_W=T0PxuT-SwC2902h0CG-Q@mail.gmail.com>
References: <CAHesJ5LES3aTDf=xp7NOwrADQ_HWC-Spsv7yLu9ZY+zxzZO53A@mail.gmail.com>
	<[email protected]>
	<CAHesJ5+ASNoSNMiC5Ms0Ts=gw7v2_UeBpUT=phujO4yE_XCbEw@mail.gmail.com>
	<CAHesJ5JbkCBZ2f_AvUr8+KWnGPAsobu4zyfnWm8bEeb7X9oqDQ@mail.gmail.com>
	<[email protected]>
	<CAHesJ5JLzhHiGSBSkJZ7x7rGgHeeByP=wWk1D5GG=x8cJ5YY6Q@mail.gmail.com>
	<CANzqJaBg5=iNXJDgk_saDD_nJAE_W=T0PxuT-SwC2902h0CG-Q@mail.gmail.com>

Each row have a PK (gdid) that will uniquely refrence 50 k/v pair set

On Mon, 23 Dec 2024, 10:35 pm Ron Johnson, <[email protected]> wrote:

> How do you uniquely reference each set of 50 k/v pairs?
>
> On Mon, Dec 23, 2024 at 12:01 PM Divyansh Gupta JNsThMAudy <
> [email protected]> wrote:
>
>> Sure , for example, I have 50 key with name as t1 , t2 ,t3 .......t50
>>
>> Now each key could have values from 0 to 3
>>
>> So let suppose we have JSONB like that for row r1
>>
>> {
>>
>> t1: 1
>>
>> t2: 2
>>
>> t3 : 3
>>
>> }
>>
>>
>> As if I convert it into columns so r1 will have
>>
>> t1 column will contain 1
>>
>> t2 column will contain 2
>>
>> ...... So on
>>
>>
>> So here my question is considering one JSONB column is perfect or
>> considering 50 columns will be more optimised.
>>
>>
>>
>> On Mon, 23 Dec 2024, 10:24 pm Adrian Klaver, <[email protected]>
>> wrote:
>>
>>> On 12/23/24 08:46, Divyansh Gupta JNsThMAudy wrote:
>>> > Also as you ask how 50 pairs turns into 50 column so each column will
>>> be
>>> > a key and the value of that key will store inside their respective
>>> > column for each row
>>>
>>> My problem with understanding this is 50 pairs = 100 values, I don't
>>> understand how that can fit in 50 columns that can only handle 1 value
>>> each. You need to provide some example data showing what you want to
>>> achieve. It does not need to be the full 50, just something to show the
>>> process.
>>>
>>>
>>> >
>>> >
>>> > On Mon, 23 Dec 2024, 10:14 pm Divyansh Gupta JNsThMAudy,
>>> > <[email protected] <mailto:[email protected]>> wrote:
>>> >
>>> >     As per the discussion with other team members they suggested if we
>>> >     store 50 values for keys in an individual column that will provide
>>> >     better performance as the data type is native (INT2) on the other
>>> >     hand if we store all the key value pair in a single JSONB column
>>> the
>>> >     performance will degrade even after applying a GIN index on that
>>> >     however the statement sounds funny but I want to take everyone
>>> openion?
>>> >
>>> >
>>> >     On Mon, 23 Dec 2024, 10:05 pm Adrian Klaver,
>>> >     <[email protected] <mailto:[email protected]>>
>>> wrote:
>>> >
>>> >         On 12/23/24 07:53, Divyansh Gupta JNsThMAudy wrote:
>>> >          > Hii Community,
>>> >          >
>>> >          > I need to provide a support for some functionality for my
>>> >         application
>>> >          > for that I need to store 50 key value pair set, so I am in a
>>> >         dilemma,
>>> >          > weather I create 50 new columns of int2 data type each
>>> column
>>> >         will
>>> >
>>> >         This is unclear, I am trying to figure out you go from '50 key
>>> >         value
>>> >         pair set' to '50 new columns of int2'.
>>> >
>>> >         In other words how 50 pairs turn into 50 columns?
>>> >
>>> >         Then there is the question of why 50 keys per row in the first
>>> >         place?
>>> >
>>> >
>>> >          > contain value of a specific key or should I go with JSONB
>>> >         data type with
>>> >          > 50 key value pair, the table on which I am going to do that
>>> >         all contains
>>> >          > 1 Billion rows of data and have 84 hash partitions, I have
>>> >         gone through
>>> >          > multiple articles some of them mentioned it's a good
>>> approach
>>> >         to create
>>> >          > 50 new columns and some states that creating one JSONB would
>>> >         be best
>>> >          > that's why I need your help to move forward, also I am ready
>>> >         to make
>>> >          > H-Store instead of JSONB if it provides better performance.
>>> >          > Please help me to comes out from that dilemma.
>>> >          >
>>> >          > Regards,
>>> >          > Divyansh Gupta,
>>> >          > Database Administrator
>>> >
>>> >         --
>>> >         Adrian Klaver
>>> >         [email protected] <mailto:[email protected]>
>>> >
>>>
>>> --
>>> Adrian Klaver
>>> [email protected]
>>>
>>>
>
> --
> Death to <Redacted>, and butter sauce.
> Don't boil me, I'm still alive.
> <Redacted> lobster!
>


view thread (13+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Need help in database design
  In-Reply-To: <CAHesJ5+vu_HGNSwDGz4YdMyUb_Yq4oTuhKBzydutcUiG1ChOtA@mail.gmail.com>

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

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