Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ougtM-00050A-TD for pgsql-novice@arkaria.postgresql.org; Mon, 14 Nov 2022 21:21:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ougtL-00080Y-Q8 for pgsql-novice@arkaria.postgresql.org; Mon, 14 Nov 2022 21:21:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ougtL-00080P-I1 for pgsql-novice@lists.postgresql.org; Mon, 14 Nov 2022 21:21:19 +0000 Received: from mout.gmx.net ([212.227.17.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ougtJ-0001vH-Db for pgsql-novice@lists.postgresql.org; Mon, 14 Nov 2022 21:21:19 +0000 Received: from mail.defcon1.lan ([93.15.31.113]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N4z6q-1p4UY4057U-010uE9 for ; Mon, 14 Nov 2022 22:21:16 +0100 Date: Mon, 14 Nov 2022 22:21:13 +0100 From: Bzzzz To: pgsql-novice@lists.postgresql.org Subject: Re: hstore or jsonb ? Message-ID: <20221114222113.513b7253@msi.defcon1.lan> In-Reply-To: References: <20221114155057.48406b86@msi.defcon1.lan> Organization: Anyone, anywhere but in banana demokratik republik of france or UERSS. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:/QONuaxS2T0O8uEYQaONv2MX3XH5IpbY8aEl5esj0pOrC0xLQrG M9aqNx2BPYNO6OfcE5FEY/mBWwaV6afuyUDnMxdd8HhoyU3WbrnkmMkt3dxO0nRwovHFL5i 8gFXvEPzkn1D3bopCbcfDclzZYyruZP4d8+jM1nMiOlyEM2LGx6oH2bJBtQaXryJLmsHC6H C/5bsCb6NruGergbbE2cw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:l9nsw4/1yfw=;YV1njjqVCgCfIoykKS2hOT5kExH ZdWYY7d+DtWxPcBlHBHGfNf51dDFlZ7r/Wbam8v1yGKAglVJNLnpfya8GVCUwws2pHoiFissw KNws3fotmQuFEhNBFzKckg7//RLbpMhn8bBIyLtzAA1CgeE1jXJRPwfifMaWM50xGqoUJ7MJ7 TiGKixUtaCz1ANbxV40XDH2+DQ2snmk00Ge+/daQP0Cs8GR694l99XA5SehmVXQLvrGa55vZS ZEOFiGG4BeyWySpXFEVe9rxagIDU6k168FkRAPF3t7Rz3gZ1hhle2pPCTzA4oi8odDd67s715 vRiZzk1VWPjjoqlzbyfvABAJa1GdCTjhB+rMCdyN7USDZxRLnp2jOYxbnsV110rCSbsxukocZ onTbn/rs41hZELJpER99Q5tIHpWI3tbAdpdtpPHRExwW6n0vGYcB9zgKW1dHqm+GRzlsOJik6 cFDfUVUdgCHQPoUa+YNA70rET/L066Fh3OUIrUwdklq0wfEALt5YjF8s06saV86j/nB095Fjo BRxjPZdlJ3CamV8xOTyHTnaYzqZYeT9JHQcUPvOERzC4tzemx9FIVhHKJ81zsfMsjPaBsi5t+ tUSBBBZATvRyFSLKEWebfXQky8waggtlhRuB2tXwb6sxbZDrEY9wf3cCcnOYaQINOYY9ssEfy NWaiQMvegXEcoPggSfXyiIaf/67CvU3qI9VigPAQ4FocAvLQAL9enTgi452aRwulQ98g/hWsW uzDb//DU2ktpXiq+z9/rf2VlxKdm1dQ0Cx258na7YNAaUOmK9hBsmoV1b55x3TnqJ9nxtTInZ dz06ivypUWQwQwUYuQ+OPbAgtCZUWX0CxUJTsye2ObugWIzvvNH5+Mz7do4b2aRobx14oTtYp LXhxY+4P3ZkdRt2bvoJLkvk8jshYwKxdC8Y13fN7/cw18kJsLRQgs0kwrgbERf+gLv0xa8d53 siNFAjwW0ZExwqlOzDZsnTp+G6I= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 14 Nov 2022 22:03:02 +0100 Laurenz Albe wrote: > On Mon, 2022-11-14 at 15:50 +0100, Bzzzz wrote: > > I'd like to store specs, as they vary a lot from one item to > > another, hstore or jsonb look like the best solution. > > > > Specs can have 2 levels at most. > > ie: "color": ["white", "black", "blue"]). > > > > The indexation is mandatory for fulltext accurate researches in > > (almost) natural language. > > > > So, as the processing is almost the same (maps I/O in Erlang), > > which one would be the best for my needs, hstore or jsonb ? > > "hstore" is obsolete; don't use it. Oh, I missed that, so jsonb it'll be. > > Also, from what I read, the both of them can be easily indexed, but > > which index is the best, GIN or RUM ? > > > > And furthermore, which index option (XXX_ops), if any, would be the > > best for the chosen one ? > > That depends on the query you need to support. > > I have no idea what you mean by "fulltext accurate search" in a hstore > or JSON. One kind, that will be something like : SELECT websearch_to_tsquery('english', 'switching power supply output tension 5 Vcc 5 A') ; This will be for external, internal queries will specify more to be more accurate/restrictive. I can't put specs into columns because they are very different from one to another family of products, hence the use of json to keep them as malleable as possible. Jean-Yves