pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Questions about btree_gin vs btree_gist for low cardinality columns
Date: Fri, 31 May 2019 16:10:54 +0700
Message-ID: <f2af83b5-ec6a-ce7f-7039-e8e91c2ae4c6@gmx.net> (raw)
In-Reply-To: <84EE4616-51B6-479D-8577-CD6F672B8260@gmail.com>
References: <CAMa1XUiRZsg7Y5OBvau=orfVv=w=Rq19RDHQRySnF6RS=-+y2g@mail.gmail.com>
	<CAMa1XUixPDxyYSy8BN4_spUc518H4WUO-URYYf6DV0=pLmV6Fg@mail.gmail.com>
	<84EE4616-51B6-479D-8577-CD6F672B8260@gmail.com>

Will Hartung schrieb am 31.05.2019 um 00:11:
> If you have 10M rows with a “STATUS” column of 1 or 2, and an index
> on that column, then you have a 2 node index with a bazillion row
> pointers. Some systems (I can’t speak to PG in this regard)
> degenerate in this kind of use case since the index is more or less
> designed to work great in unique identifiers than low cardinality
> values. The representation of large record pointer lists may just not
> be handled well as edge cases.

What I very often do in theses cases is to create two partial indexes: 

One with "WHERE status = 1" and another with "WHERE STATUS = 2" including 
_another_ column in the index that I usually use together with the status 
column in the queries.







view thread (24+ messages)  latest in thread

Message-ID: <f2af83b5-ec6a-ce7f-7039-e8e91c2ae4c6@gmx.net>
Permalink:  ../f2af83b5-ec6a-ce7f-7039-e8e91c2ae4c6@gmx.net/
Also on:    postgresql.org/message-id/f2af83b5-ec6a-ce7f-7039-e8e91c2ae4c6@gmx.net

 · 

reply

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: spam_eater@gmx.net
  Subject: Re: Questions about btree_gin vs btree_gist for low cardinality columns
  In-Reply-To: <f2af83b5-ec6a-ce7f-7039-e8e91c2ae4c6@gmx.net>
  References: <CAMa1XUiRZsg7Y5OBvau=orfVv=w=Rq19RDHQRySnF6RS=-+y2g@mail.gmail.com> <CAMa1XUixPDxyYSy8BN4_spUc518H4WUO-URYYf6DV0=pLmV6Fg@mail.gmail.com> <84EE4616-51B6-479D-8577-CD6F672B8260@gmail.com> <f2af83b5-ec6a-ce7f-7039-e8e91c2ae4c6@gmx.net>

* 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