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 1tPltm-00FApa-RM for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2024 17:07:19 +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 1tPltm-00CrwL-56 for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2024 17:07:17 +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 1tPltl-00CrwD-Qm for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2024 17:07:17 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tPltk-000D1X-0B for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2024 17:07:16 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9120025401D1; Mon, 23 Dec 2024 12:07:14 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Mon, 23 Dec 2024 12:07:14 -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=1734973634; x=1735060034; bh=HFoHOW41m8MTHYg2GthtsJBEFy3IV2ns261R0POVPtA=; b= GQ/de2EN76DEWkkP08LvvYUU3EQ4Vnr0dpFqAU/q22WRIWrrjskplICiDE6X3jby fhh5aD9WstCYHjcI42XZyxPvJgg9v8lq1Q8wJICudzByOy7IDpm7Hv5bTjEv+7Gs 4CH5t4NDt0X0bTcKasUKW24Dlh9YlMk3wqF9X9FatynKJCejHR/a8v529AmbH0zx SHfzIsHZAshaI6pGnbofdd0fqb73UrDVZ75vD7HQA8PwTQVvRJDrihMgl5sLpao+ 0yPkcClC+fq+QDZHqWKu+Kw+08SrXk7mAOOwWYfWJIFk1Ef0Ct3WErci6c0l0Ltq fgX2du1NnC9x1i90U2hTFw== 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=1734973634; x= 1735060034; bh=HFoHOW41m8MTHYg2GthtsJBEFy3IV2ns261R0POVPtA=; b=J o9X6ReILUBkUfvH7letpDPNJZWVguHEOngkWvo7WgMUKtg7L8n5NQMKr9V/0YC2C Sp3iaWm6SrC9mB8hQfQwoU5e+bMJreGRpBml+oq9xKKY+j/xgcUFGRwaBjPUxoHU qe84NbSIXOwhgNB8Ru/+b8ytiRMb2IgWdTUbQvH7AVJs+UoWKZA5fT4UC4/GI9KE eAqNfosTKQejRDQiF5gA+IRUpHw200jTJAos8qn3vzUiBCfT/o6eTRD+I8dnBbf0 HU4BIOcQrX465oaR19s0/uBVo7T9mDYALGcsQOo6p04xPiaRLNxbH/9qJBFLWbP1 1KjDdVN8GHCLLnRTrO6UA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudduvddgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgv rhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrg htthgvrhhnpefhveeihfevlefffedthedukeevfefhfedtgeeifeevteffgfefhedtffet udettdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthho pedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrghduheeijeekvdejsehgmh grihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdr phhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Dec 2024 12:07:13 -0500 (EST) Message-ID: Date: Mon, 23 Dec 2024 09:07:12 -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: <06e1f1ee-74b2-43a2-9a63-da20ae455ae2@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/23/24 09:01, Divyansh Gupta JNsThMAudy 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. > 1) How are you going to use the key:value pairs in queries? 2) I would recommend creating a sample dataset that you import into tables that are built with either the column method or the JSON method and test a representative set of queries. -- Adrian Klaver adrian.klaver@aklaver.com