Re: Lexicographic index ?

Поиск
Список
Период
Сортировка
От Peter Gibbs
Тема Re: Lexicographic index ?
Дата
Msg-id 070701c1fcd9$4312e8a0$0b01010a@emkel.co.za
обсуждение исходный текст
Ответ на Lexicographic index ?  (arnaud.mlist1@free.fr)
Ответы Re: GiST, R-TREE, Lexicographic index ?  (arnaud.mlist1@free.fr)
Список pgsql-general
----- Original Message -----
From: <arnaud.mlist1@free.fr>
To: <pgsql-general@postgresql.org>

> select * from twords where words||'%' like 'saxophones';
>
> works but uses a sequential scan on the table...


The only method I have been able to find that will use the index is to
provide both upper and lower limits on the key.

For example:

select * from twords
  where words <= 'saxophones'
    and words >= 's'
    and position(words in 'saxophones') = 1;

This uses the index in my test, whereas it doesn't if you leave out the
second condition, even if you add an 'order by' clause.
Using position is slightly faster on my system than using likes (but I am
only using the standard /usr/dict/words for testing, so I only have 45402
rows.

--
Peter Gibbs
EmKel Systems



В списке pgsql-general по дате отправления:

Предыдущее
От: jtv
Дата:
Сообщение: Re: [INTERFACES] C & C ++Program Problem
Следующее
От: Serkan Bektaş (SoftHome)
Дата:
Сообщение: Is there eny e-mail server that uses postgreSQL as backend server for mailboxes&users