![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi there, is there a way to use indexes with (i)like clauses? Should I |
#3
| |||
| |||
|
|
Anselmo Canfora<nobody (AT) nowhere (DOT) net> wrote: Hi there, is there a way to use indexes with (i)like clauses? Should I Sure, but (maybe) you have to create the index with text_pattern_ops: test=*# \d words Table "public.words" Column | Type | Modifiers --------+------+----------- t | text | Indexes: "idx_words" btree (t text_pattern_ops) test=*# explain select * from words where t like 'foo*'; QUERY PLAN ----------------------------------------------------------------------- Index Scan using idx_words on words (cost=0.00..8.28 rows=1 width=9) Index Cond: (t = 'foo*'::text) Filter: (t ~~ 'foo*'::text) (3 rows) Andreas |
![]() |
| Thread Tools | |
| Display Modes | |
| |