Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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
---------------------------------------------




pgsql-patches by date

Next:From: Tom LaneDate: 2001-06-14 18:10:45
Subject: Re: Removal of temp tables
Previous:From: Bruce MomjianDate: 2001-06-14 17:53:50
Subject: Re: Removal of temp tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group