Am 10.05.2010 23:34 schrieb Alban Hertroys:
> Thinking more on the issue, I don't see a way to prevent the nested
> loop as there's no way to decide beforehand what part of the string to
> index for b.txt. It depends on a.txt after all.
Yes, that seems to be the gist of the matter. I just felt I
On 10 May 2010, at 21:24, Christoph Zwerschke wrote:
> Am 10.05.2010 11:50 schrieb Alban Hertroys:
> > On 10 May 2010, at 24:01, Christoph Zwerschke wrote:
> >
> >> select * from b join a on b.txt like a.txt||'%'
> >>
> >> I feel there should be a performat way to query these entries,
> >> but I
Am 10.05.2010 11:50 schrieb Alban Hertroys:
> On 10 May 2010, at 24:01, Christoph Zwerschke wrote:
>
>> select * from b join a on b.txt like a.txt||'%'
>>
>> 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
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
Assume we have a table "a" with a text column "txt"
and an index on that column.
A query like the following will then be very perfomant
since it can use the index:
select * from a where txt like 'a%'
(Assume also that the server is using the C locale or the index
is set up with text_pattern_ops