[Bizgres-general] bitmap.h again
Mark Kirkwood
markir at paradise.net.nz
Sat Jan 28 08:15:08 GMT 2006
Mark Kirkwood wrote:
> I hear cries of 'Noooooooooo...' from the Bizgres boys, but. err , I
> have a suggested change to the new (i.e patch 01-15) bitmap.h.
>
> Essentially it reflects that fact that there are 2 equations to solve:
>
> no_header_words = no_words/wordsize_bits (1)
> no_words*wordsize_bytes + no_headerwords*wordsize_bytes <=
> max_possible_words*wordsize_bytes (2)
>
> (snippage)
> no_headerwords <= max_possible_words/(1 + wordsize_bits)
>
> Clearly we can then use this equation with <= changed to = .
>
>
> For typical cases, this changes the values of max header words and
> number of words per page from (1020, 7140) to (906, 7248).
> Note that currently you could actually only use 893 or the 1020 header
> words!
>
> Hey - it's not earth shattering, but may as well pack 'em it as tight as
> we can!
>
Well, I'm somewhat ashamed to say that I didn't test the previous patch
well enough!
The original patch amended the calculation for header words:
no_headerwords <= max_possible_words/(1 + wordsize_bits)
but didn't enforce the relationship between words per page and header words:
no_words = no_headerwords * wordsize_bits
So in fact there were too many words_per_page being calculated (using
the original formula)!
So anyway, revised patch attached that fixes this:
This one *really* has headerwords = 906, words_per_page = 7248 in the
typical case.
The relation sizes decrease slightly:
relname | pages(pre) | pages(post)
--------------------+------------+------------
bitmaptest_val0 | 1307 | 1287
bitmaptest_val1 | 1307 | 1287
bitmaptest_val2 | 2372 | 2343
Query times seem essentially unchanged (they were less, but I suspect
not by any amount bigger than the natural measurement variation).
Best wishes
Mark
P.s.
Note that this has nothing to do with the previous mail regarding
offsets, as that was performed with vanilla Bizgres (01-15 patch) sources.
Having said that, I don't seem to be getting any offset errors with this
patch applied, but as I'm not sure how they happen in the first place, I
not going to assert that the patch fixes this issue.
-------------- next part --------------
--- src/include/access/bitmap.h.orig Sat Jan 28 15:56:25 2006
+++ src/include/access/bitmap.h Sat Jan 28 20:25:02 2006
@@ -135,9 +135,9 @@
MAXALIGN(sizeof(PageHeaderData)) - \
MAXALIGN(sizeof(BMBitmapOpaqueData)))/sizeof(BM_HRL_WORD))
#define BM_MAX_NUM_OF_HEADER_WORDS \
- (BM_MAX_NUM_OF_HRL_WORDS_PER_PAGE/BM_HRL_WORD_SIZE)
+ (BM_MAX_NUM_OF_HRL_WORDS_PER_PAGE/(BM_HRL_WORD_SIZE + 1))
#define BM_NUM_OF_HRL_WORDS_PER_PAGE \
- (BM_MAX_NUM_OF_HRL_WORDS_PER_PAGE - BM_MAX_NUM_OF_HEADER_WORDS)
+ (BM_MAX_NUM_OF_HEADER_WORDS * BM_HRL_WORD_SIZE)
typedef struct BMBitmapData
{
More information about the Bizgres-general
mailing list