Re: FSM search modes

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndQuadrant(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, decibel <decibel(at)decibel(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FSM search modes
Date: 2009-10-03 03:33:49
Message-ID: 200910030333.n933XnI26914@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Grittner wrote:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> > (Hm, so we might want to make the probability depend on
> > max_connections?)
>
> Without doing rigorous math on it, I'd guess that to prevent
> contention among n connections you'd want the probably of resetting
> the sweep to be about 1 / (n * 2). That would mean you'd advance to
> the nth page about 60.6% of the time without resetting the sweep. For
> less contention, 1 / (n * 4) would let you get to the nth page about
> 77.9% of the time.
>
> > Maybe what we want is some bias against inserting in the last half
> > or quarter of the table, or some such rule, rather than necessarily
> > heading for the start of the relation.
>
> I think it would make sense to just start using this once you get into
> the last half or quarter of the free pages. If you go with the last
> quarter, then you might want to use a higher probability than I
> suggested above, although that would tend to leave you with contention
> when all the free space was in the last quarter. I'd be inclined to
> use something like the above probability and start using it at 50%.

Two things that might not have been mentioned: First, only reset if you
are given a page in the last 1/4 of the table; that way, if there is no
free space in the last 1/4 of the table, you will not be resetting. A
second idea is to heavily bias against using the last table page with
data in it; that should help bias toward empty pages on the end of the
table.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2009-10-03 04:20:40 Re: latest hstore patch
Previous Message daveg 2009-10-03 02:57:13 Re: Postgres server goes in recovery mode repeteadly