Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9f78bdc

Browse files
committed
Force for rum.sql and rum_hash.sql queries without ORDER BY to use bitmap scan
1 parentc5be71b commit9f78bdc

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

‎expected/rum.out

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CREATE INDEX rumidx ON test_rum USING rum (a rum_tsvector_ops);
88
CREATE INDEX failed_rumidx ON test_rum USING rum (a rum_tsvector_addon_ops);
99
ERROR: additional information attribute "a" is not found in index
1010
SET enable_seqscan=off;
11+
SET enable_indexscan=off;
1112
explain (costs off)
1213
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
1314
QUERY PLAN
@@ -35,12 +36,14 @@ ORDER BY a <=> to_tsquery('pg_catalog.english', 'ever|wrote');
3536
explain (costs off)
3637
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english',
3738
'def <-> fgr');
38-
QUERY PLAN
39-
-----------------------------------------------------------
39+
QUERY PLAN
40+
-----------------------------------------------------------------
4041
Aggregate
41-
-> Index Scan using rumidx on test_rum
42-
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
43-
(3 rows)
42+
-> Bitmap Heap Scan on test_rum
43+
Recheck Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
44+
-> Bitmap Index Scan on rumidx
45+
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
46+
(5 rows)
4447

4548
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
4649
count
@@ -288,6 +291,7 @@ DELETE FROM tst WHERE i = 5;
288291
VACUUM tst;
289292
INSERT INTO tst SELECT i%10, to_tsvector('simple', substr(md5(i::text), 1, 1)) FROM generate_series(14001,15000) i;
290293
set enable_bitmapscan=off;
294+
SET enable_indexscan=on;
291295
explain (costs off)
292296
SELECT a <=> to_tsquery('pg_catalog.english', 'w:*'), *
293297
FROM test_rum

‎expected/rum_hash.out

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CREATE INDEX rumhashidx ON test_rum_hash USING rum (a rum_tsvector_hash_ops);
77
CREATE INDEX failed_rumidx ON test_rum_hash USING rum (a rum_tsvector_addon_ops);
88
ERROR: additional information attribute "a" is not found in index
99
SET enable_seqscan=off;
10+
SET enable_indexscan=off;
1011
explain (costs off)
1112
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
1213
QUERY PLAN
@@ -34,12 +35,14 @@ ORDER BY a <=> to_tsquery('pg_catalog.english', 'ever|wrote');
3435
explain (costs off)
3536
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english',
3637
'def <-> fgr');
37-
QUERY PLAN
38-
-----------------------------------------------------------
38+
QUERY PLAN
39+
-----------------------------------------------------------------
3940
Aggregate
40-
-> Index Scan using rumhashidx on test_rum_hash
41-
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
42-
(3 rows)
41+
-> Bitmap Heap Scan on test_rum_hash
42+
Recheck Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
43+
-> Bitmap Index Scan on rumhashidx
44+
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
45+
(5 rows)
4346

4447
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
4548
count
@@ -287,6 +290,7 @@ DELETE FROM tst_hash WHERE i = 5;
287290
VACUUM tst_hash;
288291
INSERT INTO tst_hash SELECT i%10, to_tsvector('simple', substr(md5(i::text), 1, 1)) FROM generate_series(14001,15000) i;
289292
set enable_bitmapscan=off;
293+
SET enable_indexscan=on;
290294
explain (costs off)
291295
SELECT a <=> to_tsquery('pg_catalog.english', 'w:*'), *
292296
FROM test_rum_hash

‎sql/rum.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CREATE INDEX rumidx ON test_rum USING rum (a rum_tsvector_ops);
1212
CREATEINDEXfailed_rumidxON test_rum USING rum (a rum_tsvector_addon_ops);
1313

1414
SET enable_seqscan=off;
15+
SET enable_indexscan=off;
1516

1617
explain (costs off)
1718
SELECTcount(*)FROM test_rumWHERE a @@ to_tsquery('pg_catalog.english','ever|wrote');
@@ -101,6 +102,7 @@ VACUUM tst;
101102
INSERT INTO tstSELECT i%10, to_tsvector('simple', substr(md5(i::text),1,1))FROM generate_series(14001,15000) i;
102103

103104
set enable_bitmapscan=off;
105+
SET enable_indexscan=on;
104106
explain (costs off)
105107
SELECT a<=> to_tsquery('pg_catalog.english','w:*'),*
106108
FROM test_rum

‎sql/rum_hash.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CREATE INDEX rumhashidx ON test_rum_hash USING rum (a rum_tsvector_hash_ops);
1010
CREATEINDEXfailed_rumidxON test_rum_hash USING rum (a rum_tsvector_addon_ops);
1111

1212
SET enable_seqscan=off;
13+
SET enable_indexscan=off;
1314

1415
explain (costs off)
1516
SELECTcount(*)FROM test_rum_hashWHERE a @@ to_tsquery('pg_catalog.english','ever|wrote');
@@ -99,6 +100,7 @@ VACUUM tst_hash;
99100
INSERT INTO tst_hashSELECT i%10, to_tsvector('simple', substr(md5(i::text),1,1))FROM generate_series(14001,15000) i;
100101

101102
set enable_bitmapscan=off;
103+
SET enable_indexscan=on;
102104
explain (costs off)
103105
SELECT a<=> to_tsquery('pg_catalog.english','w:*'),*
104106
FROM test_rum_hash

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp