Review observations for partial REFRESH MATERIALIZED VIEW patc

vellaipandiyan sm <vellaipandiyan.sm@gmail.com>

From: vellaipandiyan sm <vellaipandiyan.sm@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-05-19T05:42:51Z
Lists: pgsql-hackers
Hello hackers,

I reviewed the REFRESH MATERIALIZED VIEW ... WHERE patch and had a few
questions around concurrency semantics.

   - The original DELETE -> INSERT approach exposing a consistency gap
   makes sense, especially once tuple locks disappear after DELETE. The newer
   FOR UPDATE + single-CTE approach seems safer, though I wonder whether
   overlapping refreshes could still encounter deadlock scenarios around
   UPSERT conflicts.
   - The CONCURRENTLY behavior also feels somewhat unintuitive here. With
   WHERE refreshes, the non-CONCURRENT path appears more permissive for
   writers than CONCURRENTLY WHERE, which seems opposite to the expectation
   established by normal REFRESH MATERIALIZED VIEW semantics.
   - It may also help to document the intended guarantees around
   overlapping partial refreshes and concurrent DML on base tables.

Overall, the use case seems quite valuable for selective high-churn refresh
workloads.

Thanks for working on this patch.

Regards,

Vellaipandiyan