Re: Waiting on ExclusiveLock on extension

From: Qingqing Zhou <zhouqq(dot)postgres(at)gmail(dot)com>
To: Andomar <andomar(at)aule(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Waiting on ExclusiveLock on extension
Date: 2015-04-16 21:23:25
Message-ID: CAJjS0u3hty3MjyRqeMkEW=M7TQjt5kEvXw+LW6Y83qXqun=FhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 16, 2015 at 1:24 PM, Andomar <andomar(at)aule(dot)net> wrote:
> After upgrading our database from 9.3.5 to 9.4.1 last night, the server
> suffers from high CPU spikes. During these spikes, there are a lot of these
> messages in the logs:
>
> process X still waiting for ExclusiveLock on extension of relation Y of
> database Z after 1036.234 ms
>
This issue has been complained several times, and here is the most recent one:
http://www.postgresql.org/message-id/0DDFB621-7282-4A2B-8879-A47F7CECBCE4@simply.name

PG 9.4.1 shall have much alleviated it by relaxing buffer pool related
locks. PG 9.4.1 shall be actually better in relation extension
handling - a possible explanation is that your 9.3.5 database has been
used for a while thus there are holes in pages, so not many extensions
are required.

>
> a) I'm assuming "extension" means growing the physical diskspace used by a
> table-- is that correct?
Yes.

> b) How can you find the name of the relation being extended? based on the
> relation number.
select <number>::regclass;

> c) Why would Postgres grow a table twice in the same millisecond? Could it
> be an index with a high fill factor?
PG extends one page each time when new space needed.

> Any suggestions on how to approach this issue are welcome.
>
There are some diagnosis in above link, see if it rings any bell. From
PG kernel side, I think fundamentally we may want to extend many pages
each time instead of one.

Regards,
Qingqing

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-04-16 21:38:56 Re: database migration question between different ubuntus and different postgresql server versions
Previous Message Octavi Fors 2015-04-16 21:01:34 database migration question between different ubuntus and different postgresql server versions