linkend="indexes-expressional"/>.)
- Also, GIN index supports @@ and @?
- operators, which perform jsonpath matching.
-SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
-
-SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ == "qui")';
-
- GIN index extracts statements of following form out of
- jsonpath: accessors_chain = const.
- Accessors chain may consist of .key,
- [*], and [index] accessors.
- jsonb_ops additionally supports .*
- and .** accessors.
-
+
Another approach to querying is to exploit containment, for example:
index.
+ GIN indexes also support the @?
+ and @@ operators, which
+ perform jsonpath matching. Examples are
+SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ == "qui")';
+
+SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
+
+ For these operators, a GIN index extracts clauses of the form
+ accessors_chain
+ = constant out of
+ the jsonpath pattern, and does the index search based on
+ the keys and values mentioned in these clauses. The accessors chain
+ may include .key,
+ [*],
+ and [index] accessors.
+ The jsonb_ops operator class also
+ supports .* and .** accessors,
+ but the jsonb_path_ops operator class does not.
+
+
Although the jsonb_path_ops operator class supports
- only queries with the @>, @@
- and @? operators, it has notable
+ only queries with the @>, @?
+ and @@ operators, it has notable
performance advantages over the default operator
class jsonb_ops. A jsonb_path_ops
index is usually much smaller than a jsonb_ops