Navigation Menu

Skip to content

Commit

Permalink
Add a SQL to test basic feature of PGroonga
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 12, 2015
1 parent c29e252 commit 148cc68
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test.sql
@@ -0,0 +1,43 @@
DROP TABLE IF EXISTS memos;
CREATE TABLE memos (
id integer,
content text
);

INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');

CREATE INDEX grnindex ON memos USING pgroonga (content);

SET enable_seqscan = off;
SET enable_indexscan = on;
SET enable_bitmapscan = on;

SELECT id, content
FROM memos
WHERE content %% 'is';

SELECT id, content
FROM memos
WHERE content %% 'text';

INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL plugin that uses Groonga.');

SELECT id, content
FROM memos
WHERE content %% 'postgresql';

UPDATE memos SET content = 'Mroonga is a MySQL plugin that uses Groonga.'
WHERE id = 3;

SELECT id, content
FROM memos
WHERE content %% 'postgresql';

SELECT id, content
FROM memos
WHERE content %% 'mysql';

SELECT id, content
FROM memos
WHERE content %% 'mysql' OR content %% 'groonga';

0 comments on commit 148cc68

Please sign in to comment.