By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
CREATE INDEX
SET
| QUERY PLAN |
|---|
| Seq Scan on demo (cost=10000000000.00..10000000027.00 rows=453 width=32) (actual time=0.007..0.007 rows=0 loops=1) |
| Filter: jsonb_contains(data, '[{"answer": "42"}]'::jsonb) |
| Planning Time: 0.146 ms |
| Execution Time: 0.318 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Bitmap Heap Scan on demo (cost=12.11..22.67 rows=14 width=32) (actual time=0.715..0.715 rows=0 loops=1) |
| Recheck Cond: (data @> '[{"answer": "42"}]'::jsonb) |
| -> Bitmap Index Scan on ref_idx (cost=0.00..12.10 rows=14 width=0) (actual time=0.708..0.708 rows=0 loops=1) |
| Index Cond: (data @> '[{"answer": "42"}]'::jsonb) |
| Planning Time: 0.836 ms |
| Execution Time: 0.766 ms |
EXPLAIN