Re: inefficient use of relation extension?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: inefficient use of relation extension?
Date: 2009-10-15 21:40:34
Message-ID: 14166.1255642834@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> While looking at this code I notice something that troubles me. Just
> after extending the relation, we don't insert the new page into the FSM.
> So if the extending backend does not do any other insertion on the page,
> it is forgotten as possible insert target until the next vacuum.

That is intentional so as not to have write contention on that page.
We would rather have several backends concurrently inserting into
different pages. Unless you've got a lot of very short-lived backends
doing one insertion apiece, it seems like the right tradeoff to me.

> I regularly (several times a day) see five or six processes all with
> pg_locks locktype=extend granted=f on the same table, waiting for a long
> time.

I'm not sure what's causing that, but I *seriously* doubt that adding
new pages to FSM right away would make it better. What it sounds like
is someone is getting hung up while holding the lock. You should try to
investigate who's got the lock when this happens, and what they're doing
or waiting for.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2009-10-15 21:43:48 Re: Trigger with WHEN clause (WIP)
Previous Message Ron Mayer 2009-10-15 21:40:16 Re: Rejecting weak passwords