Using GIN Indexes with JSON
Generalized Inverted Index types or GIN indexes[201] are a bit different from B-Tree indexes. Usually, B-Tree index entries point to single items. Exceptions to this are when columns hold nonunique values like names and duplicates are allowed. In those cases, a single B-Tree entry points to multiple rows.
However, even in that scenario, the row is present multiple times but is a single value (the name). What about data where the columns always contain multiple values or even data structures?
For example, jsonb columns with JSON formatted text could contain lots of “keys” within a structure of data. Despite that structure of data that’s not one single value, you still may have the need to efficiently query for data ...
Get High Performance PostgreSQL for Rails now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.