Re: pg_upgrade and materialized views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Claudio Freire <klaussfreire(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_upgrade and materialized views
Date: 2018-02-20 23:44:47
Message-ID: 32726.1519170287@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Claudio Freire <klaussfreire(at)gmail(dot)com> writes:
>> Well, the attached script reproduces the issue.

One thing this doesn't prove by itself is whether the use of
REFRESH MATERIALIZED VIEW CONCURRENTLY has any effect on the
situation.

I poked at that a bit and noted that REFRESH MATERIALIZED VIEW
CONCURRENTLY doesn't seem to change the matview's relfrozenxid
at all, while a plain REFRESH advances the matview's relfrozenxid
to (more or less) the current xid counter. That probably isn't
a bug, but maybe there's a missed optimization opportunity there.
At any rate, the matview's relfrozenxid isn't going backwards,
so my original fear seems unfounded.

Anyway, I'm thinking the core of the problem here is that we've got
multiple places that know which relkinds are physically transferred
during a pg_upgrade, and they don't all know the same thing. We
need to centralize that knowledge somehow, or we're going to be
singing this same tune again in the future. Not quite sure where
to put it though. pg_dump and pg_upgrade both need to know that,
but the backend doesn't, so I don't quite want to add it in
pg_class.h where the core list of relkinds is.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2018-02-21 00:06:25 Re: pg_upgrade and materialized views
Previous Message Claudio Freire 2018-02-20 23:09:08 Re: pg_upgrade and materialized views