Re: inefficient use of relation extension? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: inefficient use of relation extension?
Date
Msg-id 14166.1255642834@sss.pgh.pa.us
Whole thread Raw
In response to inefficient use of relation extension?  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: inefficient use of relation extension?
Re: inefficient use of relation extension?
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.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


pgsql-hackers by date:

Previous
From: Ron Mayer
Date:
Subject: Re: Rejecting weak passwords
Next
From: Dimitri Fontaine
Date:
Subject: Re: Trigger with WHEN clause (WIP)