Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rQrrw-003zVv-FL for pgsql-general@arkaria.postgresql.org; Fri, 19 Jan 2024 16:37:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rQrrv-00AL7w-5b for pgsql-general@arkaria.postgresql.org; Fri, 19 Jan 2024 16:37:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rQrru-00AL5t-Qv for pgsql-general@lists.postgresql.org; Fri, 19 Jan 2024 16:37:22 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rQrrs-002LPL-7A for pgsql-general@postgresql.org; Fri, 19 Jan 2024 16:37:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 40JGbIMu2630264; Fri, 19 Jan 2024 11:37:18 -0500 From: Tom Lane To: Ron Johnson cc: pgsql-general Subject: Re: B-tree index balance? In-reply-to: References: Comments: In-reply-to Ron Johnson message dated "Fri, 19 Jan 2024 11:24:56 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2630262.1705682238.1@sss.pgh.pa.us> Date: Fri, 19 Jan 2024 11:37:18 -0500 Message-ID: <2630263.1705682238@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron Johnson 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