!1106 全局分区索引适配支持ANALYZE VERIFY FAST
Merge pull request !1106 from mujinqiang/master0626
This commit is contained in:
@ -873,7 +873,12 @@ static void DoVerifyIndexRel(VacuumStmt* stmt, Oid indexRelid)
|
||||
{
|
||||
Oid heapOid = IndexGetRelation(indexRelid, false);
|
||||
Relation heapRel = heap_open(heapOid, AccessShareLock);
|
||||
if (RelationIsPartitioned(heapRel)) {
|
||||
Relation indexRel = index_open(indexRelid, AccessShareLock);
|
||||
if (!RelationIsPartitioned(heapRel) || RelationIsGlobalIndex(indexRel)) {
|
||||
VerifyIndexRel(stmt, indexRel);
|
||||
index_close(indexRel, AccessShareLock);
|
||||
} else {
|
||||
index_close(indexRel, AccessShareLock);
|
||||
Partition part;
|
||||
Relation partRel;
|
||||
ListCell* cell = NULL;
|
||||
@ -891,10 +896,6 @@ static void DoVerifyIndexRel(VacuumStmt* stmt, Oid indexRelid)
|
||||
partitionClose(heapRel, part, AccessShareLock);
|
||||
releaseDummyRelation(&partRel);
|
||||
}
|
||||
} else {
|
||||
Relation indexRel = index_open(indexRelid, AccessShareLock);
|
||||
VerifyIndexRel(stmt, indexRel);
|
||||
index_close(indexRel, AccessShareLock);
|
||||
}
|
||||
|
||||
heap_close(heapRel, AccessShareLock);
|
||||
@ -969,6 +970,13 @@ static void VerifyPartIndexRels(VacuumStmt* stmt, Relation rel, Relation partiti
|
||||
indexIds = RelationGetIndexList(rel);
|
||||
foreach (indexId, indexIds) {
|
||||
Oid indexOid = lfirst_oid(indexId);
|
||||
Relation indexRel = index_open(indexOid, AccessShareLock);
|
||||
if (RelationIsGlobalIndex(indexRel)) {
|
||||
VerifyIndexRel(stmt, indexRel);
|
||||
index_close(indexRel, AccessShareLock);
|
||||
continue;
|
||||
}
|
||||
index_close(indexRel, AccessShareLock);
|
||||
VerifyPartIndexRel(stmt, rel, partitionRel, indexOid);
|
||||
}
|
||||
return;
|
||||
|
@ -114,6 +114,9 @@ select count(*) from gpi_range_table where INV_WAREHOUSE_SK < 10000;
|
||||
9999
|
||||
(1 row)
|
||||
|
||||
analyze verify fast local_gpi_range_table_index1;
|
||||
analyze verify fast global_gpi_range_table_index1;
|
||||
analyze verify fast global_gpi_range_table_index2;
|
||||
--clean
|
||||
drop index if exists local_gpi_range_table_index1;
|
||||
drop index if exists global_gpi_range_table_index1;
|
||||
|
@ -53,6 +53,10 @@ select count(*) from gpi_range_table where INV_ITEM_SK < 10000;
|
||||
explain (costs off) select count(*) from gpi_range_table where INV_WAREHOUSE_SK < 10000;
|
||||
select count(*) from gpi_range_table where INV_WAREHOUSE_SK < 10000;
|
||||
|
||||
analyze verify fast local_gpi_range_table_index1;
|
||||
analyze verify fast global_gpi_range_table_index1;
|
||||
analyze verify fast global_gpi_range_table_index2;
|
||||
|
||||
--clean
|
||||
drop index if exists local_gpi_range_table_index1;
|
||||
drop index if exists global_gpi_range_table_index1;
|
||||
|
Reference in New Issue
Block a user