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 1tPlh4-00F93g-RT for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2024 16:54:11 +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 1tPlh3-00CZA8-Uu for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2024 16:54:09 +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 1tPlh3-00CZA0-Jh for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2024 16:54:09 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tPlh0-001FP7-Jr for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2024 16:54:08 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9B18225401A4; Mon, 23 Dec 2024 11:54:05 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 23 Dec 2024 11:54:05 -0500 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=1734972845; x=1735059245; bh=/4XKffzQqT0ttJ4LMBrw3C75xbc314ReyNHjLqB2UsA=; b= DlaZgVJNk61i+WIcO36QnIGTAJlN3KeEtm77K4tZO10GFAiBvO6Gq36khp4DgMBc ifCAuZcYo41y6g6SePHKhcVQW6S56WRyq1r3QUxybZGZSHF6RWXKfoGsoOcXrWJ+ 3e/Rwk85LRsBDft5kKz2mYOKINZhJzG8J9CpYnqZ1Ayc82eFklHpWu++A9jpqghE /UbXGs53fHQ/3GthdmUbTj+WKxn7EHc7kURE2Cr5N6UKDPa19b6SLR5R1sEs5G4g ww5NOhdwnG9N/nwOjS2B6QzDgBGrWbV0ZzNGTKGOc4w72LTFcSU0du2JqEevlqc/ A3ywoQOc2oRN37bkml1IWg== 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=1734972845; x= 1735059245; bh=/4XKffzQqT0ttJ4LMBrw3C75xbc314ReyNHjLqB2UsA=; b=o c/kgDaMFaKq6eS37X8PcL84WhVWBXYh5G7C94esFgK7gNT+FoxfSk1nZQU/BiJIy FJkcUZUkACsXUhuiaUNLw94/u459199fHl+OvRnrJkC4k2XJn+UiXF3lCLNTkajt T/agpDt4KHsaZVDda//EX+/cTBzbW60wn7MWiKpQSqrAddRb27DcJaTxTDZQda6T z2Ve4v6doP1Xrl13E0KX3YlCby/VeMNwld61+5zhOjZvDpKq4+rrSOPjnRdvRBfB RgxpUIgsPfrk1vrPA7GuijLfbRff/iWG4FP0r7/Uli3XSvm+/TdLPgPszuVifkbt NlmL4PenB3npwLdwouxBg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudduvddgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgv rhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrg htthgvrhhnpeefgeefieeutdfggfetgefgheekjeehteeileeigfetieekjedvieeviefg heevtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthho pedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrghduheeijeekvdejsehgmh grihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdr phhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Dec 2024 11:54:04 -0500 (EST) Message-ID: <06e1f1ee-74b2-43a2-9a63-da20ae455ae2@aklaver.com> Date: Mon, 23 Dec 2024 08:54:04 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Need help in database design To: Divyansh Gupta JNsThMAudy Cc: pgsql-general@lists.postgresql.org References: 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 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, > > 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, > > 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 > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com