Re: Materialized views WIP patch

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Kevin Grittner <kgrittn@mail.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2012-11-15T04:57:13Z
Lists: pgsql-hackers
Kevin Grittner wrote:

Interesting stuff.

>   /*
> +  * SetRelationIsValid
> +  *		Set the value of the relation's relisvalid field in pg_class.
> +  *
> +  * NOTE: caller must be holding an appropriate lock on the relation.
> +  * ShareUpdateExclusiveLock is sufficient.
> +  *
> +  * NOTE: an important side-effect of this operation is that an SI invalidation
> +  * message is sent out to all backends --- including me --- causing plans
> +  * referencing the relation to be rebuilt with the new list of children.
> +  * This must happen even if we find that no change is needed in the pg_class
> +  * row.
> +  */
> + void
> + SetRelationIsValid(Oid relationId, bool relisvalid)
> + {

It's not clear to me that it's right to do this by doing regular heap
updates here instead of heap_inplace_update.  Also, I think this might
end up causing a lot of pg_class tuple churn (at least for matviews that
delete rows at xact end), which would be nice to avoid.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Preserve intermediate .c files in coverage mode