Re: Index Bloat - how to tell? - Mailing list pgsql-performance

From Robert Haas
Subject Re: Index Bloat - how to tell?
Date
Msg-id AANLkTikedY0=mBZ4nFm3XQK=u08j59yqPMsrsJqA=fgP@mail.gmail.com
Whole thread Raw
In response to Re: Index Bloat - how to tell?  (Mladen Gogala <mladen.gogala@vmsinfo.com>)
Responses Re: Index Bloat - how to tell?
List pgsql-performance
On Thu, Dec 16, 2010 at 2:27 PM, Mladen Gogala
<mladen.gogala@vmsinfo.com> wrote:
> What is "leaf_fragmentation"? How is it defined? I wasn't able to find out
> any definition of that number. How is it calculated. I verified that running
> reindex makes it 0:

Well, according to the code:

                        /*
                         * If the next leaf is on an earlier block, it means a
                         * fragmentation.
                         */
                        if (opaque->btpo_next != P_NONE &&
opaque->btpo_next < blkno)
                                indexStat.fragments++;

And then the final value is calculated thus:

                snprintf(values[j++], 32, "%.2f", (double)
indexStat.fragments / (double) indexStat.leaf_pages * 100.0);

This doesn't really match my definition of the word "fragmentation", though...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-performance by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Compared MS SQL 2000 to Postgresql 9.0 on Windows
Next
From: Robert Haas
Date:
Subject: Re: Strange optimization - xmin,xmax compression :)