pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
When to REINDEX a serial key?
5+ messages / 4 participants
[nested] [flat]

* When to REINDEX a serial key?
@ 2021-07-06 09:35 Ron <ronljohnsonjr@gmail.com>
  2021-07-06 09:52 ` Re: When to REINDEX a serial key? David Rowley <dgrowleyml@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Ron @ 2021-07-06 09:35 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Server: RDS Postgresql 12.5
Client: Vanilla Postgresql 12.5

Like most systems, we have lots of tables indexed on sequences. Thus, all 
new keys are inserted into the "lower right hand corner" of the b-tree.

The legacy RDBMS which I used to manage has a tool for analyzing (*not* in 
the Postgresql meaning of the word) an index, and displaying a histogram of 
how many layers deep various parts of an index are. Using that histogram, 
you can tell whether or not an index needs to be rebuilt.

How does one get the same effect in Postgresql?

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: When to REINDEX a serial key?
  2021-07-06 09:35 When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
@ 2021-07-06 09:52 ` David Rowley <dgrowleyml@gmail.com>
  2021-07-06 12:19   ` Re: When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: David Rowley @ 2021-07-06 09:52 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

On Tue, 6 Jul 2021 at 21:35, Ron <ronljohnsonjr@gmail.com> wrote:
> The legacy RDBMS which I used to manage has a tool for analyzing (not in the Postgresql meaning of the word) an index, and displaying a histogram of how many layers deep various parts of an index are.  Using that histogram, you can tell whether or not an index needs to be rebuilt.
>
> How does one get the same effect in Postgresql?

There are a few suggestions in
https://wiki.postgresql.org/wiki/Show_database_bloat

David





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: When to REINDEX a serial key?
  2021-07-06 09:35 When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
  2021-07-06 09:52 ` Re: When to REINDEX a serial key? David Rowley <dgrowleyml@gmail.com>
@ 2021-07-06 12:19   ` Ron <ronljohnsonjr@gmail.com>
  2021-07-06 12:25     ` Re: When to REINDEX a serial key? Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Ron @ 2021-07-06 12:19 UTC (permalink / raw)
  To: PostgreSQL General <pgsql-general@lists.postgresql.org>

On 7/6/21 4:52 AM, David Rowley wrote:
> On Tue, 6 Jul 2021 at 21:35, Ron <ronljohnsonjr@gmail.com> wrote:
>> The legacy RDBMS which I used to manage has a tool for analyzing (not in the Postgresql meaning of the word) an index, and displaying a histogram of how many layers deep various parts of an index are.  Using that histogram, you can tell whether or not an index needs to be rebuilt.
>>
>> How does one get the same effect in Postgresql?
> There are a few suggestions in
> https://wiki.postgresql.org/wiki/Show_database_bloat

How does bloat relate to a lopsided b-tree?

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: When to REINDEX a serial key?
  2021-07-06 09:35 When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
  2021-07-06 09:52 ` Re: When to REINDEX a serial key? David Rowley <dgrowleyml@gmail.com>
  2021-07-06 12:19   ` Re: When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
@ 2021-07-06 12:25     ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  2021-07-06 14:06       ` Re: When to REINDEX a serial key? Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2021-07-06 12:25 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; PostgreSQL General <pgsql-general@lists.postgresql.org>


On 06.07.21 14:19, Ron wrote:
> On 7/6/21 4:52 AM, David Rowley wrote:
>> On Tue, 6 Jul 2021 at 21:35, Ron <ronljohnsonjr@gmail.com> wrote:
>>> The legacy RDBMS which I used to manage has a tool for analyzing (not 
>>> in the Postgresql meaning of the word) an index, and displaying a 
>>> histogram of how many layers deep various parts of an index are.  
>>> Using that histogram, you can tell whether or not an index needs to 
>>> be rebuilt.
>>>
>>> How does one get the same effect in Postgresql?
>> There are a few suggestions in
>> https://wiki.postgresql.org/wiki/Show_database_bloat
> 
> How does bloat relate to a lopsided b-tree?

There is no such thing as a lopsided B-tree, because a B-tree is by 
definition self-balancing.  Perhaps that answers your original question.

Bloat is generally something people are concerned about when they think 
about reindexing their indexes.  But append-only workloads, such as what 
you describe, normally don't generate bloat.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: When to REINDEX a serial key?
  2021-07-06 09:35 When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
  2021-07-06 09:52 ` Re: When to REINDEX a serial key? David Rowley <dgrowleyml@gmail.com>
  2021-07-06 12:19   ` Re: When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
  2021-07-06 12:25     ` Re: When to REINDEX a serial key? Peter Eisentraut <peter.eisentraut@enterprisedb.com>
@ 2021-07-06 14:06       ` Rob Sargent <robjsargent@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Rob Sargent @ 2021-07-06 14:06 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Ron <ronljohnsonjr@gmail.com>; PostgreSQL General <pgsql-general@lists.postgresql.org>

> 
> There is no such thing as a lopsided B-tree, because a B-tree is by definition self-balancing.  Perhaps that answers your original question.
> 
You do incur the cost of rebalancing often and the cost/frequency/extent  is related to fill factor.  

> 
> 





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-07-06 14:06 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 09:35 When to REINDEX a serial key? Ron <ronljohnsonjr@gmail.com>
2021-07-06 09:52 ` David Rowley <dgrowleyml@gmail.com>
2021-07-06 12:19   ` Ron <ronljohnsonjr@gmail.com>
2021-07-06 12:25     ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2021-07-06 14:06       ` Rob Sargent <robjsargent@gmail.com>

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