why does reindex invalidate relcache without modifying system tables - Mailing list pgsql-hackers

From wenjing zeng
Subject why does reindex invalidate relcache without modifying system tables
Date
Msg-id 5F38F5EA-2565-419F-A93C-7E31AFB1628E@gmail.com
Whole thread Raw
Responses Re: why does reindex invalidate relcache without modifying system tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi Tom

I would like to ask you about the details of index build.
I found that in the index_update_stats function, i.e. the CREATE INDEX/REINDEX/Truncate INDEX process,
relchche is invalidated whether the index information is updated. I want to know why you're did this
The code is:
        if (dirty)
         {
            heap_inplace_update(pg_class, tuple);
            /* the above sends a cache inval message */ }
        else
        {
             /* no need to change tuple, but force relcache inval anyway */
             CacheInvalidateRelcacheByTuple(tuple);
        }

There's a special line of comment here, and I think you wrote that part for some reason.

The reason I ask this question is that
1 similar places like the vac_update_relstats /vac_update_datfrozenxid function don't do this.
2 Local Temp table with ON COMMIT DELETE ROWS builds index for each transaction commit.
This causes relcache of the temp table to be rebuilt over and over again.

Looking forward to your reply.

Thanks


Wenjing





pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Add Boolean node
Next
From: Sascha Kuhl
Date:
Subject: Re: Add Boolean node