Re: Index Bloat - how to tell?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>
Cc: Dave Crooke <dcrooke(at)gmail(dot)com>, "Plugge, Joe R(dot)" <JRPlugge(at)west(dot)com>, John W Strange <john(dot)w(dot)strange(at)jpmchase(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index Bloat - how to tell?
Date: 2010-12-18 02:32:48
Message-ID: AANLkTikedY0=mBZ4nFm3XQK=u08j59yqPMsrsJqA=fgP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Dec 16, 2010 at 2:27 PM, Mladen Gogala
<mladen(dot)gogala(at)vmsinfo(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2010-12-18 02:46:55 Re: Strange optimization - xmin,xmax compression :)
Previous Message Scott Marlowe 2010-12-18 02:06:15 Re: Compared MS SQL 2000 to Postgresql 9.0 on Windows