pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: holger.vornholt@deutschebahn.com
Subject: Documentation on Hash and btree Indexes on jsonb
Date: Sat, 13 Feb 2021 09:37:19 +0000
Message-ID: <161320903985.3454.7956608521954674568@wrigleys.postgresql.org> (raw)

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/datatype-json.html
Description:

Hello everyone,

we are planning to test postgres as a nosql database for streaming kafka
events (converted to jsonb) into it next week.

Therefore I am researching on index types. We would mostly be using queries
like message @> '{"fahrtnummer": "37458"}' or message ->> 'fahrtnummer' =
'37458' respectively. Where fahrtnummer always exists and is not an array.

The documentation on https://www.postgresql.org/docs/12/datatype-json.html
claims: 
"jsonb also supports btree and hash indexes. These are usually useful only
if it's important to check equality of complete JSON documents."

According to some older information from 2016 
   
https://bitnine.net/blog-postgresql/postgresql-internals-jsonb-type-and-its-indexes/?ckattempt=1
    https://stackoverflow.com/questions/36075918/postgresql-index-on-json
it seems to be a valid option to use hash or btree indexes in that case
however.
"As a result, in the choice of an index for JSONB type, if the index
searches a few predetermined attributes, BTREE is the best choice"

The quoted sentance from the postgres documentation would suggest, that this
option could be discarded. I would love to hear your feedback on this
matter.

Thank you!
Holger


view thread (2+ messages)  latest in thread

Message-ID: <161320903985.3454.7956608521954674568@wrigleys.postgresql.org>
Permalink:  ../161320903985.3454.7956608521954674568@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/161320903985.3454.7956608521954674568@wrigleys.postgresql.org

 · 

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: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, holger.vornholt@deutschebahn.com
  Subject: Re: Documentation on Hash and btree Indexes on jsonb
  In-Reply-To: <161320903985.3454.7956608521954674568@wrigleys.postgresql.org>

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

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