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 4
extnamespace |
---|
x_unaccent |
SELECT 1
CREATE FUNCTION
CREATE INDEX
name | sim_unaccent | sim |
---|---|---|
Schoenstraße | 1 | 1 |
Schonstraße | 0.6875 | 0.6666667 |
Schönstraße | 0.6875 | 0.5625 |
Schyrenstraße | 0.6111111 | 0.5882353 |
SELECT 4
CREATE TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
CREATE INDEX
name | ts_lexize | to_tsvector | to_tsquery | match |
---|---|---|---|---|
Schyrenstraße | {Schyrenstrasse} | 'schyrenstrass':1 | 'schoenstrass' | f |
Schönstraße | {Schonstrasse} | 'schonstrass':1 | 'schoenstrass' | f |
Schonstraße | {Schonstrasse} | 'schonstrass':1 | 'schoenstrass' | f |
Schoenstraße | {Schoenstrasse} | 'schoenstrass':1 | 'schoenstrass' | t |
SELECT 4
name | to_tsvector | to_tsquery | match | similarity |
---|---|---|---|---|
Schoenstraße | 'schoenstrass':1 | 'schoenstrass' | t | 1 |
SELECT 1
SET
QUERY PLAN |
---|
Sort (cost=64.78..64.79 rows=1 width=48) |
Sort Key: ((f_unaccent(name) <-> 'Schoenstrasse'::text)), ((name <-> 'Schoenstraße'::text)) |
-> Bitmap Heap Scan on names (cost=60.00..64.77 rows=1 width=48) |
Recheck Cond: (f_unaccent(name) % 'Schoenstrasse'::text) |
-> Bitmap Index Scan on names_trgm_idx (cost=0.00..60.00 rows=1 width=0) |
Index Cond: (f_unaccent(name) % 'Schoenstrasse'::text) |
EXPLAIN
QUERY PLAN |
---|
Sort (cost=12.78..12.79 rows=1 width=137) |
Sort Key: ((name <-> 'Schoenstraße'::text)) |
-> Bitmap Heap Scan on names (cost=8.00..12.77 rows=1 width=137) |
Recheck Cond: (to_tsvector('de'::regconfig, name) @@ '''schoenstrass'''::tsquery) |
-> Bitmap Index Scan on names_fts_idx (cost=0.00..8.00 rows=1 width=0) |
Index Cond: (to_tsvector('de'::regconfig, name) @@ '''schoenstrass'''::tsquery) |
EXPLAIN