From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron Johnson <ronljohnsonjr@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: B-tree index balance?
Date: Fri, 19 Jan 2024 11:37:18 -0500
Message-ID: <2630263.1705682238@sss.pgh.pa.us> (raw)
In-Reply-To: <CANzqJaAbVCB=CA1jqX=71F1gshdeGFLN8k7ioUiQEvkMF5ZAjA@mail.gmail.com>
References: <CANzqJaAbVCB=CA1jqX=71F1gshdeGFLN8k7ioUiQEvkMF5ZAjA@mail.gmail.com>
Ron Johnson <ronljohnsonjr@gmail.com> writes:
> On an RDMS which I used in the 1990s and 2000s, b-tree indices of sequences
> would get unbalanced, since every new leaf was added to the far right
> corner of the tree.
> Sure, they would auto-balance *to a degree* during node splits, but all
> those "far-right corner" inserts still left them pretty lopsided.
> Thus, they provided a utility which we could use to determine the
> lopsidedness, and thus decide when to rebuild an index.
> Does Postgresql keep b-tree indexes on sequences fully balanced? If not,
> how do I see how unbalanced they are? (Assume PG12+.)
As far as I know, we don't have a problem of that sort. Continued
insertions will eventually force a split of the root node, which will
rebalance the tree.
regards, tom lane
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: tgl@sss.pgh.pa.us, ronljohnsonjr@gmail.com
Subject: Re: B-tree index balance?
In-Reply-To: <2630263.1705682238@sss.pgh.pa.us>
References: <CANzqJaAbVCB=CA1jqX=71F1gshdeGFLN8k7ioUiQEvkMF5ZAjA@mail.gmail.com> <2630263.1705682238@sss.pgh.pa.us>
* 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