Re: pgstattuple extension for indexes - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Re: pgstattuple extension for indexes
Date
Msg-id 20060817123632.5F47.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Whole thread Raw
Responses Re: pgstattuple extension for indexes
Re: pgstattuple extension for indexes
List pgsql-hackers
Hi Nagayasu san and folks,
I have a question about pgstatindex.

Satoshi Nagayasu <nagayasus@nttdata.co.jp> wrote:

> Attached patch has been cleaned up,
> and modified to be able to work with CVS HEAD.

Index leaf pages are ordered just after REINDEX. [1] [2] [3]
After full-split, they will be the following: [1] [3] [5] [2] [4] [6]
because new pages are allocated at the end of the index file.

I think this condition should be regarded as full-fragmented,
but pgstatindex reports that the leaf_fragmentation is 50%.


Presently, fragmentation factor is computed as the code below:
   if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno)       stat->fragments++;

But the method has the above problem. So I suggest to use whether
the right link points to the next adjacent page or not.
   if (opaque->btpo_next != P_NONE && opaque->btpo_next != blkno + 1)       stat->fragments++;

Do you think which method is better? Or do you have other ideas?

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: "Tom Dunstan"
Date:
Subject: Re: Enum proposal / design
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: [PATCHES] Adjust autovacuum naptime automatically