Re: should ConstraintRelationId ins/upd cause relcache invals?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Pg Hackers <pgsql-hackers@lists.postgresql.org>, Tomas Vondra <tomas.vondra@2ndquadrant.com>
Date: 2019-01-21T23:14:31Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Given https://www.postgresql.org/message-id/20190121193300.gknn7p4pmmjg7nqf%40alap3.anarazel.de
> and the concerns voiced in the thread quoted therein, I'm a bit
> surprised that you just went ahead with this, and backpatched it to boot.

I don't think that's relevant.  The issues there were about whether
a pg_index row update ought to cause an invalidation of the relcache
entry for the index's table (not the one for the index, which it
already takes care of).  That seems very questionable to me --- the
potentially-invalidatable info ought to be in the index's relcache entry,
not its parent table's entry, IMO.  Here, however, it's clear which
relcache entry is dependent on those pg_constraint rows (as long as Alvaro
got it right about whether to inval conrelid or confrelid ...), and
that it is indeed so dependent.

			regards, tom lane


Commits

  1. Flush relcache entries when their FKs are meddled with

  2. Restore foreign-key-aware estimation of join relation sizes.