Kouhei Sutou
null+****@clear*****
Wed Sep 23 19:09:27 JST 2015
Kouhei Sutou 2015-09-23 19:09:27 +0900 (Wed, 23 Sep 2015) New Revision: 0008e5ad3f00f01793c9daf6231deecfd4c3efa1 https://github.com/pgroonga/pgroonga/commit/0008e5ad3f00f01793c9daf6231deecfd4c3efa1 Message: jsonb test: add a test for string search Added files: expected/jsonb/string/bitmapscan.out expected/jsonb/string/indexscan.out sql/jsonb/string/bitmapscan.sql sql/jsonb/string/indexscan.sql Added: expected/jsonb/string/bitmapscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/string/bitmapscan.out 2015-09-23 19:09:27 +0900 (e07f00b) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '{"name": "apple"}'); +INSERT INTO fruits VALUES (2, '{"type": "apple"}'); +INSERT INTO fruits VALUES (3, '{"name": "peach"}'); +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 @@ 'string == "apple"' + ORDER BY id; + id | items +----+------------------- + 1 | {"name": "apple"} + 2 | {"type": "apple"} +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/string/indexscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/string/indexscan.out 2015-09-23 19:09:27 +0900 (443173e) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '{"name": "apple"}'); +INSERT INTO fruits VALUES (2, '{"type": "apple"}'); +INSERT INTO fruits VALUES (3, '{"name": "peach"}'); +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 @@ 'string == "apple"' + ORDER BY id; + id | items +----+------------------- + 1 | {"name": "apple"} + 2 | {"type": "apple"} +(2 rows) + +DROP TABLE fruits; Added: sql/jsonb/string/bitmapscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/string/bitmapscan.sql 2015-09-23 19:09:27 +0900 (c7ea89f) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '{"name": "apple"}'); +INSERT INTO fruits VALUES (2, '{"type": "apple"}'); +INSERT INTO fruits VALUES (3, '{"name": "peach"}'); + +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 @@ 'string == "apple"' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/string/indexscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/string/indexscan.sql 2015-09-23 19:09:27 +0900 (dc54aa3) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '{"name": "apple"}'); +INSERT INTO fruits VALUES (2, '{"type": "apple"}'); +INSERT INTO fruits VALUES (3, '{"name": "peach"}'); + +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 @@ 'string == "apple"' + ORDER BY id; + +DROP TABLE fruits; -------------- next part -------------- HTML����������������������������... 下載