Re: Partial match in GIN

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Partial match in GIN
Date: 2008-04-05 19:21:52
Message-ID: 47F7D150.4030501@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Teodor Sigaev wrote:
> For each
> matched entry all corresponding ItemPointers are collected in TIDBitmap
> structure to effective merge ItemPointers from different entries. Patch
> introduces following changes in interface:

Looking at the patch, you require that the TIDBitmap fits in work_mem in
non-lossy format. I don't think that's acceptable, it can easily exceed
work_mem if you search for some very common word. Failing to execute a
valid query is not good.

> Here there is a unclean issue: now tsquery has new flag to label prefix
> search and cstring representation has backward compatibility, but
> external binary hasn't it now. Now, extra byte is used for storage of
> this flag. In other hand, there 4 unused bits in external binary
> representation (in byte stores weights of lexeme), so it's possible to
> use one of them to store this flag. What are opinions?

I don't think the storage size of tsquery matters much, so whatever is
the best solution in terms of code readability etc.

> NOTICE 1: current index support of LIKE believes that only BTree can
> speed up LIKE and becomes confused with this module with error
> 'unexpected opfamily' in
> prefix_quals(). For this reason, partial match patch adds small check
> before
> calling expand_indexqual_opclause().

Hmm. match_special_index_operator() already checks that the index's
opfamily is pattern_ops, or text_ops with C-locale. Are you reusing the
same operator families for wildspeed? Doesn't it then also get confused
if you do a "WHERE textcol > 'foo'" query by hand?

> NOTICE 2: it seems to me, that similar technique could be implemented
> for ordinary BTree to eliminate hack around LIKE support.

Yep, if you created a b-tree index on the reversed key, that could be
used for LIKE '%foo' expressions. And if you had that in addition to a
regular b-tree index, you could use those two indexes together for any
LIKE expression. I wonder what the size and performance of that would be
like, in comparison to the proposed GIN solution?

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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-04-05 19:40:35 Re: updated hash functions for postgresql v1
Previous Message Alvaro Herrera 2008-04-05 18:00:15 Re: Expose checkpoint start/finish times into SQL.