By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE
INSERT 0 10
CREATE INDEX
reference | word | spelling |
---|---|---|
1 | any | {a,n,y} |
2 | annoy | {a,n,n,o,y} |
3 | no | {n,o} |
4 | an | {a,n} |
5 | toy | {t,o,y} |
8 | n | {n} |
9 | nn | {n,n} |
10 | nnn | {n,n,n} |
SELECT 8
?column? |
---|
t |
SELECT 1
?column? |
---|
t |
SELECT 1
?column? |
---|
f |
SELECT 1
CREATE FUNCTION
exact | fast_with_false_positives | reference | word | spelling |
---|---|---|---|---|
f | f | 7 | annoyance | {a,n,n,o,y,a,n,c,e} |
f | f | 6 | annoying | {a,n,n,o,y,i,n,g} |
f | t | 10 | nnn | {n,n,n} |
f | t | 2 | annoy | {a,n,n,o,y} |
f | t | 9 | nn | {n,n} |
t | t | 4 | an | {a,n} |
t | t | 3 | no | {n,o} |
t | t | 8 | n | {n} |
t | t | 1 | any | {a,n,y} |
t | t | 5 | toy | {t,o,y} |
SELECT 10
reference | word | spelling |
---|---|---|
1 | any | {a,n,y} |
3 | no | {n,o} |
4 | an | {a,n} |
5 | toy | {t,o,y} |
8 | n | {n} |
SELECT 5
SET
QUERY PLAN |
---|
Bitmap Heap Scan on word_mash_dictionary (cost=28.00..32.26 rows=1 width=68) |
Recheck Cond: (spelling <@ '{a,n,o,y,t}'::text[]) |
Filter: f_arr_is_contained(spelling, '{a,n,o,y,t}'::text[]) |
-> Bitmap Index Scan on word_mash_dictionary_spelling_idx (cost=0.00..28.00 rows=1 width=0) |
Index Cond: (spelling <@ '{a,n,o,y,t}'::text[]) |
EXPLAIN