Re: Finding rows with text columns beginning with other text columns

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Finding rows with text columns beginning with other text columns
Дата
Msg-id F90AE329-82B8-42C6-931A-47A0337B7808@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Finding rows with text columns beginning with other text columns  (Christoph Zwerschke <cito@online.de>)
Ответы Re: Finding rows with text columns beginning with other text columns  (Christoph Zwerschke <cito@online.de>)
Список pgsql-general
On 10 May 2010, at 24:01, Christoph Zwerschke wrote:

> We want to find all entries in b where txt begins with an
> existing txt entry in a:
>
> select * from b join a on b.txt like a.txt||'%'
>
> On the first glance you would expect that this is performant
> since it can use the index, but sadly it doesn't work.
> The problem seems to be that Postgres can not guarantee that
> column a.txt does not contain a '%', so it cannot optimize.
>
> I feel there should be a performat way to query these entries,
> but I can't come up with anything. Can anybody help me?


Have you tried using substring instead of like?

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4be7d6ec10411051620847!



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

Предыдущее
От: "OisinJK"
Дата:
Сообщение: Create View from command line
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Query that produces index information for a Table