Skip site navigation (1) Skip section navigation (2)

pgsql: Teach ANALYZE to clear pg_class.relhassubclass whenappropriate.

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 whenappropriate.
Date: 2011-09-02 18:29:43
Message-ID: E1QzYUp-0000Yh-Ab@gemulon.postgresql.org (view raw or flat)
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(-)

pgsql-committers by date

Next:From: Peter EisentrautDate: 2011-09-02 22:30:14
Subject: pgsql: Add archive_command example
Previous:From: Alvaro HerreraDate: 2011-09-02 16:53:12
Subject: Re: [COMMITTERS] pgsql: Remove "fmgr.h" include in cube contrib --- caused crash on a Ge

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group