Обсуждение: GIN multi-column index

Поиск
Список
Период
Сортировка

GIN multi-column index

От
Floris Van Nee
Дата:

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