Re: pg_relation_size locking

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_relation_size locking
Date: 2005-12-12 13:05:12
Message-ID: 20051212130512.GB19555@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andreas Pflug wrote:
> Until recently, pg_relation_size used SearchSysCache to locate the
> relation to examine, and calculated the file location from that
> information. Starting with dbsize.c V1.5 (committed after Beta2),
> relation_open(.., AccessShareLock) is used. This is very unfortunate
> because it will not allow to observe a table growing while it is
> populated, e.g. with a lengthy COPY; pg_relation_size will be blocked.
> After reverting to 1.4, everything was fine again.

The diff:
http://projects.commandprompt.com/projects/public/pgsql/changeset/23120

The problem with the original coding was that it used the table Oid to
look up the file name, which is wrong. (Test it with a table that has
been clustered or an index that has been reindexed.)

We could use a SysCache on filenode, if there was one. Unfortunately I
don't think we have it.

> Can we have this reverted/fixed?

If you can see a way without reintroducing the old bugs, let me know.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anjan Kumar. A. 2005-12-12 13:09:42 Re: Please Help: PostgreSQL Query Optimizer
Previous Message Andrew Dunstan 2005-12-12 12:32:56 Re: psql patch: new host/port