Re: init_sequence spill to hash table - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: init_sequence spill to hash table
Date
Msg-id 5284D83D.8030603@vmware.com
Whole thread Raw
In response to Re: init_sequence spill to hash table  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: init_sequence spill to hash table  (David Rowley <dgrowleyml@gmail.com>)
Re: init_sequence spill to hash table  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On 14.11.2013 14:38, David Rowley wrote:
> I've just completed some more benchmarking of this. I didn't try dropping
> the threshold down to 2 or 0 but I did tests at the cut over point and
> really don't see much difference in performance between the list at 32 and
> the hashtable at 33 sequences. The hash table version excels in the 16000
> sequence test in comparison to the unpatched version.
>
> Times are in milliseconds of the time it took to call currval() 100000
> times for 1 sequence.
>       Patched Unpatched increased by  1 in cache 1856.452 1844.11 -1%  32 in
> cache 1841.84 1802.433 -2%  33 in cache 1861.558  not tested N/A  16000 in
> cache 1963.711 10329.22 426%

If I understand those results correctly, the best case scenario with the 
current code takes about 1800 ms. There's practically no difference with 
N <= 32, where N is the number of sequences touched. The hash table 
method also takes about 1800 ms when N=33. The performance of the hash 
table is O(1), so presumably we can extrapolate from that that it's the 
same for any N.

I think that means that we should just completely replace the list with 
the hash table. The difference with a small N is lost in noise, so 
there's no point in keeping the list as a fast path for small N. That'll 
make the patch somewhat simpler.
- Heikki



pgsql-hackers by date:

Previous
From: Claudio Freire
Date:
Subject: Re: Optimize kernel readahead using buffer access strategy
Next
From: Andres Freund
Date:
Subject: Re: init_sequence spill to hash table