On 11/9/05, Andrus <eetasoft@xxxxxxxxx> wrote: > > you can create two indexes: > > > > CREATE INDEX myindex_lc on mytable(col1 text_pattern_ops); > > and > > CREATE INDEX myindex_normal ON foo(col1); > > > > the first one will be used when using LIKE and the other for normal > > comparisons . > > Jaime, > > CREATE INDEX myindex_normal ON foo(col1); > > Creates btree structure. In other dbm system btree structure can be used for > searches where only some first characters in index key are known. > and the same is true for postgres when you use C LOCALE, but because some implementation details i don't know so deep when using non-C LOCALE you need the class operator in order to use the index with LIKE 'pattern%' > So I see no reason to create second index using text_pattern_ops for this > purpose. > the reason is that you want to use the index in the search... and, at least you go and solve the problem with code, that's the way to do it... -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match