Free space management within heap page - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Free space management within heap page
Date
Msg-id 2e78013d0701230018m7bebdd35t32bdc8ea786511e8@mail.gmail.com
Whole thread Raw
Responses Re: Free space management within heap page  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Free space management within heap page  (Heikki Linnakangas <heikki@enterprisedb.com>)
List pgsql-hackers
<br clear="all" />I am thinking that maintaining fragmented free space within a heap page might be a good idea. It
wouldhelp us to reuse the free space ASAP without waiting for a vacuum run on the page. This in turn will lead to
lesserheap bloats and also increase the probability of placing updated tuple in the same heap page as the original one.
<br/><br />So during a sequential or index scan, if a tuple is found to be dead, the corresponding line pointer is
marked"unused" and the space is returned to a free list. This free list is maintained within the page. A linked-list
canbe used for this purpose and the special area of the heap-page can be used to track the fragment list. We can
maintainsome additional information about the fragmented space such as, total_free_space, max_fragment_size,
num_of_fragmentsetc in the special area. <br /><br />During UPDATEs, if we find that there is no free space in the
block,the fragment list is searched (either first-fit or best-fit), the required space is consumed and the remaining
spaceis returned to the free list. <br /><br />We might not be able to reuse the line pointers because indexes may have
referencesto it. All such line pointers will be freed when the page is vacuumed during the regular vacuum.<br /><br
/>Thanks,<br/>Pavan<br /><br />EnterpriseDB     <a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a> 

pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: [GENERAL] Autovacuum Improvements
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Free space management within heap page