18

i am trying to create gin index on bigint column and getting an error (PostgreSQL 9.1.9 / Debian 7).

CREATE TABLE test (id bigint CONSTRAINT test_pkey PRIMARY KEY, field bigint);

CREATE INDEX idx_test_field ON test using GIN(field);

ERROR:  data type bigint has no default operator class for access method "gin"
HINT:  You must specify an operator class for the index or define a default operator class for the data type.

Is there no default support for int8 gin,gist indexes ?

1
  • 2
    Why do you want to build gin or gist indexes on bigint? Those indexes are for specialized data structures such as geometries, intarray etc.. A simple B-tree index supports >,<,= which is basically all the functionality you need for BIGINTS. Commented May 30, 2014 at 7:43

1 Answer 1

28

There's generally no reason to create a GiST or GIN index on a primitive type.

If you do require this - say, if you want a composite index that includes both some primitive types and some more complex GiST / GIN-only index types - then you will want the btree_gist or btree_gin modules, as appropriate.

CREATE EXTENSION btree_gin;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.