On Fri, Jan 6, 2012 at 11:05 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> After thinking about this a bit, I think the problem is that the
>> divisor we picked is still too high. Suppose we set num_clog_buffers
>> = (shared_buffers / 4MB), with a minimum of 4 and maximum of 32.
>
> Works for me.
Done. I tested this on my MacBook Pro and I see no statistically
significant difference from the change on a couple of small pgbench
tests. Hopefully that means this is good on large boxes and at worst
harmless on small ones.
As far as I can see, the trade-off is this: If you increase the number
of CLOG buffers, then your CLOG miss rate will go down. On the other
hand, the cost of looking up a CLOG buffer will go up. At some point,
the reduction in the miss rate will not be enough to pay for a longer
linear search - which also means holding CLogControlLock. I think
it'd probably be worthwhile to think about looking for something
slightly smarter than a linear search at some point, and maybe also
looking for a way to partition the locking better. But, this at least
picks the available load-hanging fruit, which is a good place to
start.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company