提交 3fd8a618 编写于 作者: P Pengzhou Tang 提交者: Tang Pengzhou

Use index scan on pg_resgroupcapability for resource group

We used to use sequence scan on pg_resgroupcapability for functions that
need to do a full scan of pg_resgroupcapability. Problem is accessing
in this way will take a long time after pg_resgroupcapability table was
updated/deleted million times as our stress tests do, pg_resgroupcapability
was filled of invalid blocks and sequence scan wasted lots of time to bypass
those blocks. Using index scan on it can resolve this problem.
上级 ee1d30c9
......@@ -194,7 +194,7 @@ CreateResourceGroup(CreateResourceGroupStmt *stmt)
pg_resgroup_rel = heap_open(ResGroupRelationId, ExclusiveLock);
/* Check if max_resource_group limit is reached */
sscan = systable_beginscan(pg_resgroup_rel, InvalidOid, false,
sscan = systable_beginscan(pg_resgroup_rel, ResGroupRsgnameIndexId, false,
SnapshotNow, 0, NULL);
nResGroups = 0;
while (systable_getnext(sscan) != NULL)
......@@ -1228,7 +1228,7 @@ validateCapabilities(Relation rel,
int totalCpu = options->cpuRateLimit;
int totalMem = options->memLimit;
sscan = systable_beginscan(rel, InvalidOid, false, SnapshotNow, 0, NULL);
sscan = systable_beginscan(rel, ResGroupCapabilityResgroupidIndexId, true, SnapshotNow, 0, NULL);
while (HeapTupleIsValid(tuple = systable_getnext(sscan)))
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册