提交 0a712615 编写于 作者: A Ashwin Agrawal

Avoid diskIO on master for create index and reindex.

relpages is not updated on master during create index and reindex, as
master need to have agreegated value from segments. As not updating the
relpages, avoid calling RelationGetNumberOfBlocks for master in this
function.
上级 7d2d89f6
......@@ -1248,7 +1248,6 @@ static void
index_update_stats(Relation rel, bool hasindex, bool isprimary,
Oid reltoastidxid, double reltuples)
{
BlockNumber relpages = RelationGetNumberOfBlocks(rel);
Oid relid = RelationGetRelid(rel);
Relation pg_class;
HeapTuple tuple;
......@@ -1365,6 +1364,9 @@ index_update_stats(Relation rel, bool hasindex, bool isprimary,
rd_rel->reltuples = (float4) reltuples;
dirty = true;
}
BlockNumber relpages = RelationGetNumberOfBlocks(rel);
if (rd_rel->relpages != (int32) relpages)
{
rd_rel->relpages = (int32) relpages;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册