With this schema:
create table object (
obj_id serial primary key,
name varchar(80) not null unique,
description text,
tag_arr
You can create GIN indexes on any 1-dimensional array with standard Postgres.
Details in the manual here (last chapter).
While operating with integer
arrays (plain int4
, not int2
or int8
and no NULL
values) the additional supplied module intarray provides a lot more operators and typically superior performance. Install it (once per database) with:
CREATE EXTENSION intarray;
You can create GIN or GIST indexes on integer arrays. There are examples in the manual.
CREATE EXTENSION requires PostgreSQL 9.1 or later. For older versions you need to run the supplied script.