By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 5
CREATE INDEX
| id | data |
|---|---|
| 1 | {"bar": "hello", "baz": null, "foo": 20} |
| 2 | {"bar": "bye", "baz": "urg", "foo": "hello"} |
SELECT 2
SET
| QUERY PLAN |
|---|
| Bitmap Heap Scan on tbl t (cost=56.00..60.01 rows=1 width=36) |
| Recheck Cond: (data @? '$.keyvalue()?(@."key" like_regex "foo|bar")?(@."value" == "hello")'::jsonpath) |
| -> Bitmap Index Scan on tbl_data_pathops_idx (cost=0.00..56.00 rows=1 width=0) |
| Index Cond: (data @? '$.keyvalue()?(@."key" like_regex "foo|bar")?(@."value" == "hello")'::jsonpath) |
EXPLAIN