-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug that valid tables/columns are removed by VACUUM/ANALYZE
It's caused after you use REINDEX. [groonga-dev,03850] Reported by Naoki Takami. Thanks!!!
- Loading branch information
Showing
5 changed files
with
137 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
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.'); | ||
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.'); | ||
CREATE INDEX pgrn_index ON memos USING pgroonga (content); | ||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT oid | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
?column? | ||
---------- | ||
true | ||
(1 row) | ||
|
||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT relfilenode | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
?column? | ||
---------- | ||
true | ||
(1 row) | ||
|
||
REINDEX INDEX pgrn_index; | ||
ANALYZE; | ||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT oid | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
?column? | ||
---------- | ||
false | ||
(1 row) | ||
|
||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT relfilenode | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
?column? | ||
---------- | ||
true | ||
(1 row) | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = on; | ||
SET enable_bitmapscan = off; | ||
SELECT id, content | ||
FROM memos | ||
WHERE content %% 'PGroonga' AND content %% 'Groonga'; | ||
id | content | ||
----+------------------------------------------------------- | ||
3 | PGroonga is a PostgreSQL extension that uses Groonga. | ||
(1 row) | ||
|
||
DROP TABLE memos; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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.'); | ||
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.'); | ||
|
||
CREATE INDEX pgrn_index ON memos USING pgroonga (content); | ||
|
||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT oid | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT relfilenode | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
|
||
REINDEX INDEX pgrn_index; | ||
|
||
ANALYZE; | ||
|
||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT oid | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
SELECT pgroonga.command( | ||
'object_exist ' || | ||
'Sources' || (SELECT relfilenode | ||
FROM pg_class | ||
WHERE relname = 'pgrn_index'))::jsonb->1; | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = on; | ||
SET enable_bitmapscan = off; | ||
|
||
SELECT id, content | ||
FROM memos | ||
WHERE content %% 'PGroonga' AND content %% 'Groonga'; | ||
|
||
DROP TABLE memos; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters