</para>
<table id="functions-jsonb-type-mapping-table">
- <title>RFC-4627/JSON type to PostgreSQL type mapping</title>
+ <title>PostgreSQL type to RFC-4627/JSON type mapping</title>
<tgroup cols="3">
<thead>
<row>
</thead>
<tbody>
<row>
- <entry><literal>=</literal></entry>
+ <entry><literal>=</literal></entry>
<entry>jsonb</entry>
<entry>Is the jsonb equal to this jsonb?</entry>
- <entry><literal>'[1,2,3]'::jsonb = '[1,2,3]'::jsonb</literal></entry>
+ <entry><literal>'[1,2,3]'::jsonb = '[1,2,3]'::jsonb</literal></entry>
</row>
<row>
- <entry><literal>@></literal></entry>
+ <entry><literal>@></literal></entry>
<entry>jsonb</entry>
<entry>Does the jsonb contain within it this jsonb?</entry>
<entry><literal>'{"a":1, "b":2}'::jsonb @> '{"b":2}'::jsonb</literal></entry>
</row>
<row>
- <entry><literal><@</literal></entry>
+ <entry><literal><@</literal></entry>
<entry>jsonb</entry>
<entry>Does the jsonb have contained within it this jsonb object?</entry>
- <entry><literal>'{"b":2}'::jsonb <@ '{"a":1, "b":2}'::jsonb</literal></entry>
+ <entry><literal>'{"b":2}'::jsonb <@ '{"a":1, "b":2}'::jsonb</literal></entry>
</row>
<row>
- <entry><literal>?</literal></entry>
+ <entry><literal>?</literal></entry>
<entry>text</entry>
<entry>Does this key exist?</entry>
- <entry><literal>'{"a":1, "b":2}'::jsonb ? 'b'</literal></entry>
+ <entry><literal>'{"a":1, "b":2}'::jsonb ? 'b'</literal></entry>
</row>
<row>
- <entry><literal>?|</literal></entry>
+ <entry><literal>?|</literal></entry>
<entry>text[]</entry>
<entry>Do any of these keys exist?</entry>
- <entry><literal>'{"a":1, "b":2}'::jsonb ?| array['b', 'c']</literal></entry>
+ <entry><literal>'{"a":1, "b":2}'::jsonb ?| array['b', 'c']</literal></entry>
</row>
<row>
- <entry><literal>?&</literal></entry>
+ <entry><literal>?&</literal></entry>
<entry>text[]</entry>
<entry>Do all of these keys exist?</entry>
- <entry><literal>'{"a":1, "b":2}'::jsonb ?& array['a', 'b']</literal></entry>
+ <entry><literal>'{"a":1, "b":2}'::jsonb ?& array['a', 'b']</literal></entry>
</row>
</tbody>
</tgroup>
</table>
+ <para>
+ <type>jsonb</> has GiST and GIN index support for the
+ <literal>@></>, <literal>?</>, <literal>?&</> and
+ <literal>?|</> operators. For example:
+ </para>
+ <programlisting>
+CREATE INDEX hidx ON testhstore USING GIST (h);
+
+CREATE INDEX hidx ON testhstore USING GIN (h);
+ </programlisting>
+ <para>
+ The non-default GIN operator class <literal>jsonb_hash_ops</>
+ supports indexing the <literal>@></> operator:
+ </para>
+ <programlisting>
+CREATE INDEX hidx ON testhstore USING GIN (h jsonb_hash_ops);
+ </programlisting>
+ <para>
+ <type>jsonb</> also supports <type>btree</> and <type>hash</>
+ indexes.
+ </para>
+
<!--
The release notes contain a reference to "functions-json-table". Since
that table is now split in two, the id has been parked here so we don't