Re: Proposal for Null Bitmap Optimization(for Trailing NULLs)

From: "Gokulakannan Somasundaram" <gokul007(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>, "pgsql-hackers list" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal for Null Bitmap Optimization(for Trailing NULLs)
Date: 2008-03-25 19:36:18
Message-ID: 9362e74e0803251236s673b5a70kff1a9262f581dbd1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Hi,
As said, i am attaching the performance test results and the same patch
in this thread works with the latest CVS head.
Actually, i am seeing a slight performance improvement with the patch, which
i think might be either because of noise/ lesser pages. i ran it with the
default settings. i have tested only inserts and selects, because that's
where the code change has happened.

Regarding Tom's comments....
As far as the changes are concerned, the patch changes the following
functions
a) heap_fill_tuple
b) nocachegetattr
c) heap_form_tuple
d) index_form_tuple
e) nocache_index_getattr
f) changed the macros index_getattr, IndexTupleSize, IndexTupleDSize
g) Introduced a new macro IndexTupleActualSize

The patch introduces the following changes to the storage of tuples
1) If there are only trailing nulls, it doesn't store the null bitmap
2) If there are non-trailing nulls and trailing nulls, it stores the
null-bitmap only till the last non-null value. so it decreases the storage
requirement of null bitmap. This is expected to have only very few use-cases
3) It doesn't store the null-bitmap for trailing nulls in indexes also

The functions mentioned in d), e), f), g) are required for the functionality
of index null-bitmap handling. I suppose, we can't handle it with only
heap_form_tuple. Please correct me, if i am wrong..

For having the functionality 2), we have to touch the heap_fill_tuple. i
have done the trick, by asking it to use the passed number of attributes,
instead of taking it from tupdesc. Again please advice me on how to
implement this with only heap_form_tuple.

Looking forward for comments/suggestions.....

Thanks,
Gokul.

Attachment Content-Type Size
Trailing null - results.ods application/vnd.oasis.opendocument.spreadsheet 11.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-03-25 19:36:43 Re: gcc 4.3 breaks ContribCheck in 8.2 and older.
Previous Message Neil Conway 2008-03-25 19:33:20 Re: Idea for minor tstore optimization

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2008-03-25 19:42:44 Re: tuplestore_putvalues()
Previous Message Neil Conway 2008-03-25 19:17:04 Re: tuplestore_putvalues()