pgsql: Teach ANALYZE to clear pg_class.relhassubclass when appropriate.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Teach ANALYZE to clear pg_class.relhassubclass when appropriate.
Date: 2011-09-02 18:29:43
Message-ID: E1QzYUp-0000Yh-Ab@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Teach ANALYZE to clear pg_class.relhassubclass when appropriate.

In the past, relhassubclass always remained true if a relation had ever had
child relations, even if the last subclass was long gone. While this had
only marginal performance implications in most cases, it was annoying, and
I'm now considering some planner changes that would raise the cost of a
false positive. It was previously impractical to fix this because of race
condition concerns. However, given the recent change that made tablecmds.c
take ShareExclusiveLock on relations that are gaining a child (commit
fbcf4b92aa64d4577bcf25925b055316b978744a), we can now allow ANALYZE to
clear the flag when it's no longer relevant. There is no additional
locking cost to do so, since ANALYZE takes ShareExclusiveLock anyway.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5b562644fec696977df4a82790064e8287927891

Modified Files
--------------
src/backend/catalog/pg_inherits.c | 7 ++++---
src/backend/commands/analyze.c | 12 +++++++-----
src/backend/commands/tablecmds.c | 28 +++++++++++++++++++---------
src/include/commands/tablecmds.h | 2 ++
4 files changed, 32 insertions(+), 17 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2011-09-02 22:30:14 pgsql: Whitespace adjustment for consistency in the file
Previous Message Alvaro Herrera 2011-09-02 16:53:12 Re: [COMMITTERS] pgsql: Remove "fmgr.h" include in cube contrib --- caused crash on a Ge