Re: ERROR: Gin doesn't support full scan due to it's awful

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Charlie Savage <cfis(at)savagexi(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: Gin doesn't support full scan due to it's awful
Date: 2006-09-06 07:42:46
Message-ID: 44FE7BF6.8090407@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> explain analyze
> select *
> from test.features
> where to_tsquery('') @@ features.vector
>
> ERROR: Gin doesn't support full scan due to it's awful inefficiency

Look:
contrib_regression=# select '{1,2,3}'::int4[] @ '{}'; --contains
?column?
----------
t
(1 row)

contrib_regression=# select '{1,2,3}'::int4[] && '{}'; --overlap
?column?
----------
f
(1 row)

contrib_regression=# select to_tsvector('asdasd') @@ ''::tsquery;
NOTICE: query doesn't contain lexeme(s)
?column?
----------
f
(1 row)

Semantic of different operation with void (but not NULL) argument is very
different. If query doesn't contain any entry (returned by extractQuery() index
support method), then GIN, in any case, doesn't know what it should return:
whole set of pointers or nothing. But GIN can't return all - it will be
very-very slow, because there is a lot of pointers in GIN index to each table's row.

It seems to me that message makes confuse about reason of error...

>
> Interestingly this works:
>
> explain analyze
> select *
> from test.features
> where NULL @@ features.vector

That is because @@ is marked as 'returns NULL on NULL input', ie index will not
be used.

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message zeljko 2006-09-06 07:58:11 Re: compressed protocol
Previous Message Dawid Kuroczko 2006-09-06 07:29:23 Re: constraint -- one or the other column not null