of PostgreSQL. It has built-in lossy compression.
Current implementation provides index support for one-dimensional array of
-int4's - gist__int_ops, suitable for small and medium size of arrays (used on
+integers: gist__int_ops, suitable for small and medium size of arrays (used by
default), and gist__intbig_ops for indexing large arrays (we use superimposed
-signature with length of 4096 bits to represent sets).
+signature with length of 4096 bits to represent sets). There is also a
+non-default gin__int_ops for GIN indexes on integer arrays.
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
STORAGE intbig_gkey;
--GIN
---mark built-in gin's _int4_ops as non default
-update pg_catalog.pg_opclass set opcdefault = 'f'
-where opcmethod = (select oid from pg_catalog.pg_am where amname='gin') and
- opcname = '_int4_ops';
CREATE FUNCTION ginint4_queryextract(internal, internal, int2)
RETURNS internal
LANGUAGE C;
CREATE OPERATOR CLASS gin__int_ops
-DEFAULT FOR TYPE _int4 USING gin
+FOR TYPE _int4 USING gin
AS
OPERATOR 3 &&,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
(1 row)
DROP INDEX text_idx;
-CREATE INDEX text_idx on test__int using gin ( a );
+CREATE INDEX text_idx on test__int using gin ( a gin__int_ops );
SELECT count(*) from test__int WHERE a && '{23,50}';
count
-------
SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
DROP INDEX text_idx;
-CREATE INDEX text_idx on test__int using gin ( a );
+CREATE INDEX text_idx on test__int using gin ( a gin__int_ops );
SELECT count(*) from test__int WHERE a && '{23,50}';
SELECT count(*) from test__int WHERE a @@ '23|50';
DROP FUNCTION querytree(query_int);
DROP TYPE query_int CASCADE;
-
---mark built-in gin's _int4_ops as default again
-update pg_catalog.pg_opclass set opcdefault = 't'
-where opcmethod = (select oid from pg_catalog.pg_am where amname='gin') and
- opcname = '_int4_ops';