1CREATE TABLE fruits ( 2 id int, 3 items jsonb 4); 5INSERT INTO fruits VALUES (1, '["apple"]'); 6INSERT INTO fruits VALUES (2, '["banana", "apple"]'); 7INSERT INTO fruits VALUES (3, '["peach"]'); 8CREATE INDEX pgroonga_index ON fruits 9 USING pgroonga (items pgroonga.jsonb_ops_v2); 10SET enable_seqscan = off; 11SET enable_indexscan = on; 12SET enable_bitmapscan = off; 13EXPLAIN (COSTS OFF) 14SELECT id, items 15 FROM fruits 16 WHERE items &@~ 'banana OR peach' 17 ORDER BY id; 18 QUERY PLAN 19--------------------------------------------------------- 20 Sort 21 Sort Key: id 22 -> Index Scan using pgroonga_index on fruits 23 Index Cond: (items &@~ 'banana OR peach'::text) 24(4 rows) 25 26SELECT id, items 27 FROM fruits 28 WHERE items &@~ 'banana OR peach' 29 ORDER BY id; 30 id | items 31----+--------------------- 32 2 | ["banana", "apple"] 33 3 | ["peach"] 34(2 rows) 35 36DROP TABLE fruits; 37