possible patch to increase number of hash overflow pages?

Started by Stephen Ramseyabout 25 years ago1 messagespatches
Jump to latest
#1Stephen Ramsey
sramsey@internap.com

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@internap.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@internap.com
telephone 206.504.5361
facsimile 206.447.1870
---------------------------------------------