diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-02-05 13:43:37 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-02-05 13:43:46 -0500 |
commit | ac8bc3b6e4a28cf7cd33fe11866d72f6deb2a38f (patch) | |
tree | 99d55a65c34ce6a9662d5cb8e4e665845d7df631 /src/backend/access/nbtree/nbtree.c | |
parent | 14aa601f50edefb18f65956a4b32131b9c9ea2da (diff) | |
download | postgresql-ac8bc3b6e4a28cf7cd33fe11866d72f6deb2a38f.tar.gz postgresql-ac8bc3b6e4a28cf7cd33fe11866d72f6deb2a38f.zip |
Remove unnecessary relcache flushes after changing btree metapages.
These flushes were added in my commit d2896a9ed, which added the btree
logic that keeps a cached copy of the index metapage data in index relcache
entries. The idea was to ensure that other backends would promptly update
their cached copies after a change. However, this is not really necessary,
since _bt_getroot() has adequate defenses against believing a stale root
page link, and _bt_getrootheight() doesn't have to be 100% right.
Moreover, if it were necessary, a relcache flush would be an unreliable way
to do it, since the sinval mechanism believes that relcache flush requests
represent transactional updates, and therefore discards them on transaction
rollback. Therefore, we might as well drop these flush requests and save
the time to rebuild the whole relcache entry after a metapage change.
If we ever try to support in-place truncation of btree indexes, it might
be necessary to revisit this issue so that _bt_getroot() can't get caught
by trying to follow a metapage link to a page that no longer exists.
A possible solution to that is to make use of an smgr, rather than
relcache, inval request to force other backends to discard their cached
metapages. But for the moment this is not worth pursuing.
Diffstat (limited to 'src/backend/access/nbtree/nbtree.c')
-rw-r--r-- | src/backend/access/nbtree/nbtree.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index b7f9e2e1608..1da9548d57b 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -149,14 +149,6 @@ btbuild(PG_FUNCTION_ARGS) #endif /* BTREE_BUILD_STATS */ /* - * If we are reindexing a pre-existing index, it is critical to send out a - * relcache invalidation SI message to ensure all backends re-read the - * index metapage. We expect that the caller will ensure that happens - * (typically as a side effect of updating index stats, but it must happen - * even if the stats don't change!) - */ - - /* * Return statistics */ result = (IndexBuildResult *) palloc(sizeof(IndexBuildResult)); |