Hi Nagayasu san and folks,
I have a question about pgstatindex.

Satoshi Nagayasu <[EMAIL PROTECTED]> 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



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to