From: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
---|---|
To: | Christopher Kings-Lynne <chris(dot)kings-lynne(at)calorieking(dot)com> |
Cc: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: GIN: Generalized Inverted iNdex. |
Date: | 2006-05-18 09:20:02 |
Message-ID: | 446C3C42.2020807@sigaev.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
> Ok, I can look into this now...
Good, thank you.
>
> I'm not sure really where to being though. What are all the new
> operators? What does it even mean to use a GIN over an int[] column?
Patch introduces three new operators over one-dimensional arrays (left and
rights args should have the same real type) without null elements:
* anyarray @ anyarray - contains
true, if all elements of right array exists in left one
* anyarray && anyarray - overlap
true, if it exists at least one element in both arrays
* anyarray ~ anyarray - contained
true, if all elements of left array exists in right one
Operations @ and ~ are commutators.
Pls, note:
* type of array element must have equality operator, finding by
typentry = lookup_type_cache(element_type, TYPECACHE_EQ_OPR_FINFO);
typentry->eq_opr_finfo.fn_oid
Equality operator is searching by the same way as it does by
'anyarray = anyarray' operator.
* nulls element is prohibited because we can't find correct logic for
result of operations:
* '{1,2,3}' @ '{1,NULL}' - is it true or false?
* '{1,2,3,NULL}' @ '{1,NULL}' - ???
I see that '{NULL}'::int[] = '{NULL}'::int[] returns true, but NULL = NULL
returns NULL, should I treat NULL element in array as usual element with
specific value and suppose that NULL=NULL?
* non-one-dimensional arrays have similar problem for definition:
'{{1,2},{3,4}}' @ '{1,3}' - ?
GIN has built-in support of that 3 operations over
select pg_type.typname, pg_opclass.opcname from pg_am, pg_opclass, pg_type
where pg_opclass.opcamid = pg_am.oid and pg_am.amname='gin' and
pg_opclass.opcintype = pg_type.oid;
Contrib/intarray adds support to GIN for 'int4[] @@ query_int' operation
(boolean search in array), contrib/tsearch2 use GIN to speed up 'tsvector @@
tsquery'
> I guess it's a little more difficult to understand than I guessed...
Hope, it will be easier that you think :)
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-05-18 16:02:30 | pgsql: Mention that gcc/sparc generates sparcv7 binaries. |
Previous Message | Christopher Kings-Lynne | 2006-05-18 06:06:10 | Re: pgsql: GIN: Generalized Inverted iNdex. |