GIN multi-column index - Mailing list pgsql-general

From Floris Van Nee
Subject GIN multi-column index
Date
Msg-id 2312f8d2fb514fb38dc5c33ec9db5f38@opammb0562.comp.optiver.com
Whole thread Raw
List pgsql-general

Hi,

 

I’ve been looking at using GIN indices in some of my tables and was wondering something about their behavior when using them as a multi-column index. Suppose we have a table ‘t’ with column ‘a’ as int and column ‘b’ as int[]. Suppose we also have a query like:

select * from t where a=1 and b@>’{2}’

If I define a GIN index on (a, b) (with contrib extension btree_gin), will this be a significant improvement over a GIN index just on b (significant meaning, a similar improvement to what you would expect for a btree multi-column index in a similar situation where the equality is tested on first column and the second column is an inequality)? I know in a btree index the speedup is generally significant as long as your left-most index column has an equality comparison, due to the way btree indices work. But I couldn’t find information in the docs on how GIN indices behave in such a situation and why.

 

-Floris

pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Re: DB size difference after restore
Next
From: David Gauthier
Date:
Subject: Re: How can I get and handle the status of sql statements that run inplpgsql ?