Re: BTREE index: field ordering

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: BTREE index: field ordering
Date: 2025-03-28 17:04:24
Message-ID: CAKFQuwZwwoODiq5ZW7EvCotrfk7jK-wKVnzx=s_NCT7TgM7DmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 28, 2025 at 10:02 AM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> Selectivity is evaluating cardinality with an eye on the frequency of
> the values you are actually going to be filtering on. So low cardinality
> booleans can be highly selective in usage if you are looking for the rare
> false in a sea of trues but low selectivity if looking through those trues.
>

And to accommodate the highly-selective case a partial index is much better
than indexing the low cardinality boolean column values.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sasa Vilic 2025-03-28 19:38:50 Concurrent delete and insert on same key, potentially a bug
Previous Message David G. Johnston 2025-03-28 17:02:29 Re: BTREE index: field ordering