pgsql: Teach ANALYZE to clear pg_class.relhassubclass when appropriate. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Teach ANALYZE to clear pg_class.relhassubclass when appropriate.
Date
Msg-id E1QzYUp-0000Yh-Ab@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Remove "fmgr.h" include in cube contrib --- caused crash on a Ge
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Whitespace adjustment for consistency in the file