Thread: Reclaiming Index Free Pages

Reclaiming Index Free Pages

From
"Ramy M.Hassan"
Date:
I was wondering how index access methods reclaim the free disk pages after
they are no longer used. 
I noticed that only btree access method uses the free space map. I couldn't
find in the source code of gist special handling for free pages ( like
maintaining a free list ). Does that mean that GiST indexes ( as an example
) will continue to grow forever wasting any deleted pages till the index is
rebuilt ? I also wonder why don't access methods maintain a list of free
pages for each index ?


Ramy M. Hassan
Purdue University
Research Scholar



Re: Reclaiming Index Free Pages

From
Tom Lane
Date:
"Ramy M.Hassan" <rhassan@cs.purdue.edu> writes:
> I was wondering how index access methods reclaim the free disk pages after
> they are no longer used. 

Btree and hash can both recycle unused pages, though neither is very
good about physically shrinking the file (neither can move existing
pages for instance).  I dunno anything about rtree or gist though.

If you've got a horribly bloated index that you need to physically
shrink, REINDEX is the recommended answer at the moment.
        regards, tom lane