possible patch to increase number of hash overflow pages?

From: Stephen Ramsey <sramsey(at)internap(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: possible patch to increase number of hash overflow pages?
Date: 2001-06-14 18:00:20
Message-ID: Pine.LNX.4.21.0106141100040.28386-100000@sramsey.ocp.internap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hello all,

I hope it is OK to post to this mailing list regarding this issue (if not,
please let me know...).

I was attempting to index an int4 column on a table with 6x10^7 rows using
the "hash" index algorithm under PostgreSQL 7.1 on Debian Linux, and
received the following error message:

nubs=# create index throughput_index_service_fk on throughput_datum using
hash (service_fk);

ERROR: HASH: Out of overflow pages. Out of luck.

Looking into the source code a bit, it looked (to my untrained eye) as if
it might be possible to increase the number of overflow pages, with a
patch to src/include/access/hash.h to use a 32-bit "overflow page address"
data type rather than a 16-bit "overflow page address" data type.
However, I really don't know much about the internals of postgres or its
hash algorithm, so I thought I should ask to see if this change would be
at all workable. If doing this is just a *bad* idea, please let me know;
I'm new to Postgres and am guessing this issue must have come up before...

Here is the patch:
------------------

sramsey.ocp$ diff hash.h hash.h.new
42a43,45
>
> /* SAR hacking this to see if the overflow page addresses can be
increased in size to 32 bits */
>
44c47,48
< typedef bits16 OverflowPageAddress;
---
> /*typedef bits16 OverflowPageAddress;*/
> typedef bits32 OverflowPageAddress;
51,52c55,56
< #define SPLITSHIFT 11
< #define SPLITMASK 0x7FF
---
> #define SPLITSHIFT 24
> #define SPLITMASK 0xFFFFFF
138c142
< #define NCACHED 32
---
> #define NCACHED 256

Will this work? Please CC "sramsey(at)internap(dot)com" for any replies, because
I'm not on the mailing list.

Thanks in advance,
Steve Ramsey

---------------------------------------------
Stephen Ramsey

Software Engineer
Core Software Development
Internap Network Services

e-mail sramsey(at)internap(dot)com
telephone 206.504.5361
facsimile 206.447.1870
---------------------------------------------

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2001-06-14 18:10:45 Re: Removal of temp tables
Previous Message Bruce Momjian 2001-06-14 17:53:50 Re: Removal of temp tables