Thread: Dense index?

Dense index?

From
Tatsuo Ishii
Date:
While looking into pg_filedump output of int4 btree index, It strikes
me that in leaf pages about 25% of page is wasted because of 8 byte
alignment (MAXALIGN on 64bit architecture): an index tuple consists of
8 byte tuple header + 4 byte key + 4 byte alignment, thus 4/(8+4+4) =
25% is waste.

I know that the alignment is required for faster memory access, but
sometimes we may want to save disk space for index to save I/O because
these days customers want to handle huge number of rows. To make index
more "dense", can we add an option something like "dense index" to
align index tuples by using INTALIGN rather than MAXALIGN?

I feel like this had been discussed before but I couldn't find the
discussion.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



Re: Dense index?

From
Tom Lane
Date:
Tatsuo Ishii <ishii@postgresql.org> writes:
> I know that the alignment is required for faster memory access, but
> sometimes we may want to save disk space for index to save I/O because
> these days customers want to handle huge number of rows. To make index
> more "dense", can we add an option something like "dense index" to
> align index tuples by using INTALIGN rather than MAXALIGN?

Only if you want it to crash hard on most non-Intel architectures.
        regards, tom lane



Re: Dense index?

From
Tatsuo Ishii
Date:
> Only if you want it to crash hard on most non-Intel architectures.

Of course some CPU architecture prohibits none word boundary access
and we need to do either:

1) do not allow to use the option on such an architecture

2) work hard to use temporary buffer which is properly aligned

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



Re: Dense index?

From
Peter Geoghegan
Date:
On Wed, Aug 27, 2014 at 10:16 PM, Tatsuo Ishii <ishii@postgresql.org> wrote:
> I know that the alignment is required for faster memory access, but
> sometimes we may want to save disk space for index to save I/O because
> these days customers want to handle huge number of rows. To make index
> more "dense", can we add an option something like "dense index" to
> align index tuples by using INTALIGN rather than MAXALIGN?

I think we should certainly consider it.

-- 
Peter Geoghegan