From: Floris Van Nee <florisvannee@Optiver.com>
To: 'pgsql-general@lists.postgresql.org' <pgsql-general@lists.postgresql.org>
Subject: GIN multi-column index
Date: Wed, 3 Oct 2018 13:10:24 +0000
Message-ID: <2312f8d2fb514fb38dc5c33ec9db5f38@opammb0562.comp.optiver.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: florisvannee@Optiver.com
Subject: Re: GIN multi-column index
In-Reply-To: <2312f8d2fb514fb38dc5c33ec9db5f38@opammb0562.comp.optiver.com>
References: <2312f8d2fb514fb38dc5c33ec9db5f38@opammb0562.comp.optiver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox