From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Trying to reduce per tuple overhead (bitmap) |
Date: | 2002-06-02 22:08:46 |
Message-ID: | 200206022208.g52M8ku10342@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Manfred Koizar wrote:
> Tom Lane wrote in another tread:
> > PS: I did like your point about BITMAPLEN; I think that might be
> > a free savings. I was waiting for you to bring it up on hackers
> > before commenting though...
> So here we go...
>
> Hi,
>
> in htup.h MinHeapTupleBitmapSize is defined to be 32, i.e. the bitmap
> uses at least so many bits, if the tuple has at least one null
> attribute. The bitmap starts at offset 31 in the tuple header. The
> macro BITMAPLEN calculates, for a given number of attributes NATTS,
> the length of the bitmap in bytes. BITMAPLEN is the smallest number n
> divisible by 4, so that 8*n >= NATTS.
>
> The size of the tuple header is rounded up to a multiple of 4 (on a
> typical(?) architecture) by MAXALIGN(...). So we get:
>
> NATTS BITMAPLEN THSIZE
> 8 4 36
> 16 4 36
> 33 8 40
>
> I don't quite understand the definition of BITMAPLEN:
>
> #define BITMAPLEN(NATTS) \
> ((((((int)(NATTS) - 1) >> 3) + 4 - (MinHeapTupleBitmapSize >> 3)) \
> & ~03) + (MinHeapTupleBitmapSize >> 3))
Thanks for improving this. I had to look at this macro recently and it
was quite confusing.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-06-02 22:18:47 | Re: Compilation failed when --with-recode specified (patch) |
Previous Message | Bruce Momjian | 2002-06-02 21:53:35 | Re: [BUGS] Bug #655: win32 client and bytea column |