spgist text_ops and LIKE
От | Robert Haas |
---|---|
Тема | spgist text_ops and LIKE |
Дата | |
Msg-id | CA+TgmobxzEkZO-bxWM+7qeuewG481eGqVEyfhDWHq7rokUKY8Q@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: spgist text_ops and LIKE
|
Список | pgsql-hackers |
Is spgist intended to support prefix searches with LIKE? I ask because, first, it seems like something spgist ought to be good at (unless I'm confused), and, second, the text_ops opfamily includes these operators: ~<~(text,text)~<=~(text,text)~>=~(text,text)~>~(text,text) ...which seems to be the same operators that are used for btree pattern-matching searches: rhaas=# explain select count(*) from person where last_name like 'WAR%'; QUERY PLAN ------------------------------------------------------------------------------------------Aggregate (cost=2519.27..2519.28rows=1 width=0) -> Bitmap Heap Scan on person (cost=24.70..2496.75 rows=9005 width=0) Filter:(last_name ~~ 'WAR%'::text) -> Bitmap Index Scan on person_tpo (cost=0.00..22.45 rows=900 width=0) Index Cond: ((last_name ~>=~ 'WAR'::text) AND (last_name ~<~ 'WAS'::text)) (5 rows) ...but when I create an index like this: create index person_spg on person using spgist (last_name text_ops); ...I can't get LIKE to use it, even if I disable seqscans. Thoughts? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: