Re: hash index improving v3

From: "Alex Hunsaker" <badalex(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Zdenek Kotala" <Zdenek(dot)Kotala(at)sun(dot)com>, "Xiao Meng" <mx(dot)cogito(at)gmail(dot)com>, pgsql-patches(at)postgresql(dot)org, "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
Subject: Re: hash index improving v3
Date: 2008-09-05 03:48:41
Message-ID: 34d269d40809042048m3b532a5ej7a9588f63a788d0c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, Sep 4, 2008 at 8:17 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I guess one thing we could do for testing purposes is lobotomize one of
> the datatype-specific hash functions. For instance, make int8_hash
> return the input mod 2^32, ignoring the upper bytes. Then it'd be easy
> to compute different int8s that hash to the same thing.

Heh Ok im slowly getting there... So we lobotomize hashint8 and then
time how long it takes to make an index on a table... something like:
create table test_hash(num int8);

(obviously on a 64 bit machine)
int main(void)
{
unsigned long y = 0;
unsigned cnt = 0;

printf("insert into test_hash (num) values ");

//while(cnt != LONG_MAX/UINT_MAX)
while(cnt < 10000000)
{
y += UINT_MAX;

printf("(%ld), ", y);

cnt++;
}

printf("(0);\n");

}

./a.out | psql

pgbench -c 1 -t1000 -n -f test.sql

test.sql:
create index test_hash_num_idx on test_hash using hash (num);
drop index test_hash_num_idx;

For both pre and post patch just to make sure post patch is not worse
than pre patch???

If im still way off and its not to much trouble want to give me a test
case to run =) ?

Or maybe because hash collisions should be fairly rare its not
something to really worry about?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Bradetich 2008-09-05 04:40:05 [Review] Tests citext casts by David Wheeler.
Previous Message Brendan Jurd 2008-09-05 02:48:43 Re: Need more reviewers!

Browse pgsql-patches by date

  From Date Subject
Next Message Alex Hunsaker 2008-09-05 06:32:16 Re: hash index improving v3
Previous Message Tom Lane 2008-09-05 02:19:05 Re: hash index improving v3