Re: Partial match in GIN

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Partial match in GIN
Date: 2008-04-08 19:29:45
Message-ID: 47FBC7A9.4070803@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Alvaro Herrera wrote:
> Heikki Linnakangas wrote:
>> Teodor Sigaev wrote:
>
>>> GIN speeds up '%foo%' too - which is impossible for btree. But I don't
>>> like a hack around LIKE support in BTree. This support uses outflank
>>> ways missing regular one.
>> You could satisfy '%foo%' using a regular and a reverse B-tree index,
>> and a bitmap AND. Which is interestingly similar to the way you proposed
>> to use a TIDBitmap within GIN.
>
> Huh, can you? I can see doing "col LIKE 'foo%' OR reverse(col) LIKE
> reverse('%foo')" with two btree indexes, but not a true %foo% ...

That should be AND, not OR..

Hmm. It is the same as far as I can see. Am I missing something?

You couldn't support more complex patterns directly, like 'foo%bar%foo',
but you could still split that into 'foo%' AND '%bar%' AND '%foo', and
recheck the matches against the original pattern

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2008-04-08 19:32:33 EXPLAIN progress info
Previous Message Merlin Moncure 2008-04-08 19:26:34 Re: [PATCHES] libpq type system 0.9a