Re: Best way to use indexes for partial match at beginning
| От | Jaime Casanova |
|---|---|
| Тема | Re: Best way to use indexes for partial match at beginning |
| Дата | |
| Msg-id | c2d9e70e0511091315x715c9749k3ca5d316bc5417a3@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Best way to use indexes for partial match at beginning ("Andrus" <eetasoft@online.ee>) |
| Список | pgsql-general |
On 11/9/05, Andrus <eetasoft@online.ee> 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 ;)
В списке pgsql-general по дате отправления: