Kouhei Sutou
null+****@clear*****
Wed Sep 23 20:05:10 JST 2015
Kouhei Sutou 2015-09-23 20:05:10 +0900 (Wed, 23 Sep 2015) New Revision: cc580162a93733c46cd475c4d73a152a3aa16846 https://github.com/pgroonga/pgroonga/commit/cc580162a93733c46cd475c4d73a152a3aa16846 Message: jsonb test: add a test for boolean search Added files: expected/jsonb/boolean/bitmapscan.out expected/jsonb/boolean/indexscan.out sql/jsonb/boolean/bitmapscan.sql sql/jsonb/boolean/indexscan.sql Added: expected/jsonb/boolean/bitmapscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/boolean/bitmapscan.out 2015-09-23 20:05:10 +0900 (c85624d) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '{"apple": true}'); +INSERT INTO fruits VALUES (2, '{"banana": false}'); +INSERT INTO fruits VALUES (3, '{"peach": true}'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + id | items +----+----------------- + 1 | {"apple": true} + 3 | {"peach": true} +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/boolean/indexscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/boolean/indexscan.out 2015-09-23 20:05:10 +0900 (892b33e) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '{"apple": true}'); +INSERT INTO fruits VALUES (2, '{"banana": false}'); +INSERT INTO fruits VALUES (3, '{"peach": true}'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + id | items +----+----------------- + 1 | {"apple": true} + 3 | {"peach": true} +(2 rows) + +DROP TABLE fruits; Added: sql/jsonb/boolean/bitmapscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/boolean/bitmapscan.sql 2015-09-23 20:05:10 +0900 (49733fb) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '{"apple": true}'); +INSERT INTO fruits VALUES (2, '{"banana": false}'); +INSERT INTO fruits VALUES (3, '{"peach": true}'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; + +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/boolean/indexscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/boolean/indexscan.sql 2015-09-23 20:05:10 +0900 (f72bd6d) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '{"apple": true}'); +INSERT INTO fruits VALUES (2, '{"banana": false}'); +INSERT INTO fruits VALUES (3, '{"peach": true}'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + +DROP TABLE fruits; -------------- next part -------------- HTML����������������������������... Télécharger