Re: Hash index build patch has *worse* performance at small table sizes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Raney <twraney(at)comcast(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Hash index build patch has *worse* performance at small table sizes
Date: 2008-06-22 00:37:56
Message-ID: 27492.1214095076@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Did we ever do anything about this?

Seems to be in there in CVS HEAD:

/*
* If we just insert the tuples into the index in scan order, then
* (assuming their hash codes are pretty random) there will be no locality
* of access to the index, and if the index is bigger than available RAM
* then we'll thrash horribly. To prevent that scenario, we can sort the
* tuples by (expected) bucket number. However, such a sort is useless
* overhead when the index does fit in RAM. We choose to sort if the
* initial index size exceeds effective_cache_size.
*
* NOTE: this test will need adjustment if a bucket is ever different
* from one page.
*/
if (num_buckets >= (uint32) effective_cache_size)
buildstate.spool = _h_spoolinit(index, num_buckets);
else
buildstate.spool = NULL;

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-06-22 03:10:55 PG Pool Party (formerly MomjiCon) date set
Previous Message Bruce Momjian 2008-06-21 22:34:47 Re: Hash index build patch has *worse* performance at small table sizes