int4 in a GiST index

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: int4 in a GiST index
Date: 2004-11-10 21:51:35
Message-ID: b918cf3d04111013513df817ec@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello all,

I am using tsearch2 to (imagine this... :) index a text field. There
is also a, for lack of a better name, "classification" field called
'field' that will be used to group certain rows together.

CREATE TABLE biblio.metarecord_field_entry (
record BIGINT REFERENCES biblio.metarecord (id)
ON UPDATE CASCADE
ON DELETE SET NULL
DEFERRABLE
INITIALLY DEFERRED,
field INT NOT NULL
REFERENCES biblio.metarecord_field_map (id)
ON UPDATE CASCADE
ON DELETE CASCADE
DEFERRABLE
INITIALLY DEFERRED,
value TEXT,
value_fti tsvector,
source BIGINT NOT NULL
REFERENCES biblio.record (id)
ON UPDATE CASCADE
ON DELETE CASCADE
DEFERRABLE
INITIALLY DEFERRED
) WITHOUT OIDS;

Because there will be "or" queries against the 'value_fti' I want to
create a multi-column index across the tsvector and classification
columns as that should help with selectivity. But because there is no
GiST opclass for INT4 the index creation complains thusly:

oils=# CREATE INDEX metarecord_field_entry_value_and_field_idx ON
biblio.metarecord_field_entry USING GIST (field, value_fti);
ERROR: data type integer has no default operator class for access
method "gist"
HINT: You must specify an operator class for the index or define a
default operator class for the data type.

I attempted to give it the 'int4_ops' class, but that also complains:

oils=# CREATE INDEX metarecord_field_entry_value_and_field_idx ON
biblio.metarecord_field_entry USING GIST (value_fti, field int4_ops);
ERROR: operator class "int4_ops" does not exist for access method "gist"

I couldn't find any info in the docs (7.4 and 8.0.0b4) for getting
GiST to index standard integers. I'm sure this has been done before,
but I've note found the magic spell. Of course, I may just be barking
up the wrong tree altogether...

Thanks in advance!

--
Mike Rylander
mrylander(at)gmail(dot)com
GPLS -- PINES Development
Database Developer

Browse pgsql-performance by date

  From Date Subject
Next Message George Essig 2004-11-11 02:50:28 Re: int4 in a GiST index
Previous Message Rod Taylor 2004-11-10 17:04:12 Solaris 9 Tuning Tips requested