Thread

  1. Re: Avoid calling SetMatViewPopulatedState if possible

    cca5507 <cca5507@qq.com> — 2026-05-08T02:27:02Z

    > But refreshing a materialized view doesn't only change relispopulated
    > but also columns like relfilenode, relpages, relhasindex, etc. Doesn't
    > changing these columns during REFRESH MATERIALIZED VIEW make your
    > optimization applicable in a lot less cases?
    
    I don't think so. If we can skip SetMatViewPopulatedState(), we avoid generating
    a dead pg_class tuple in all cases.
    
    > I'm actually wondering why it works at all, even in the example you
    > gave. Because I thought that even when nothing has changed the pg_class
    > row is updated for more columns than just relispopulated.
    
    "refresh materialized view concurrently" is done by doing DELETE + INSERT
    to the matview directly, so only relispopulated will change before the patch.
    After the patch, the pg_class row don't change anymore.
    
    --
    Regards,
    ChangAo Chen