From: Laurenz Albe <laurenz.albe@cybertec.at>
To: holger.vornholt@deutschebahn.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: Documentation on Hash and btree Indexes on jsonb
Date: Mon, 15 Feb 2021 13:53:47 +0100
Message-ID: <27b8149fad9bdf3efd96c7a69d91898e2734f98a.camel@cybertec.at> (raw)
In-Reply-To: <161320903985.3454.7956608521954674568@wrigleys.postgresql.org>
References: <161320903985.3454.7956608521954674568@wrigleys.postgresql.org>
On Sat, 2021-02-13 at 09:37 +0000, PG Doc comments form wrote:
> 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.
The PostgreSQL documentation is talking about a B-tree index on the complete
JSON, while the article is talking about a B-tree index on an expression that
extracts one attribute of the JSON.
These are quite different things, so both are correct.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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: laurenz.albe@cybertec.at, holger.vornholt@deutschebahn.com, pgsql-docs@lists.postgresql.org
Subject: Re: Documentation on Hash and btree Indexes on jsonb
In-Reply-To: <27b8149fad9bdf3efd96c7a69d91898e2734f98a.camel@cybertec.at>
* 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