Repository: incubator-hawq Updated Branches: refs/heads/master a9e010eda -> c5e0beb22
HAWQ-223. Improve AOGetSegFileDataLocation performane. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/c5e0beb2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/c5e0beb2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/c5e0beb2 Branch: refs/heads/master Commit: c5e0beb22d9dc5c5f5c0c220aa6fbeaddb21ac21 Parents: a9e010e Author: hubertzhang <hzh...@pivotal.io> Authored: Fri Dec 4 16:33:16 2015 +0800 Committer: hubertzhang <hzh...@pivotal.io> Committed: Mon Dec 7 15:41:11 2015 +0800 ---------------------------------------------------------------------- src/backend/cdb/cdbdatalocality.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/c5e0beb2/src/backend/cdb/cdbdatalocality.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/cdbdatalocality.c b/src/backend/cdb/cdbdatalocality.c index e860b69..3b087de 100644 --- a/src/backend/cdb/cdbdatalocality.c +++ b/src/backend/cdb/cdbdatalocality.c @@ -1246,6 +1246,11 @@ static void AOGetSegFileDataLocation(Relation relation, aoscan = systable_beginscan(pg_aoseg_rel, InvalidOid, FALSE, metadataSnapshot, 0, NULL); + // get targetPolicy + GpPolicy *targetPolicy = NULL; + Oid myrelid = rel_data->relid; + targetPolicy = GpPolicyFetch(CurrentMemoryContext, myrelid); + while (HeapTupleIsValid(tuple = systable_getnext(aoscan))) { BlockLocation *locations = NULL; int block_num; @@ -1257,9 +1262,6 @@ static void AOGetSegFileDataLocation(Relation relation, int64 logic_len = (int64) DatumGetFloat8( fastgetattr(tuple, Anum_pg_aoseg_eof, pg_aoseg_dsc, NULL)); bool isRelationHash = true; - GpPolicy *targetPolicy = NULL; - Oid myrelid = rel_data->relid; - targetPolicy = GpPolicyFetch(CurrentMemoryContext, myrelid); if (targetPolicy->nattrs == 0) { isRelationHash = false; } @@ -1421,6 +1423,12 @@ static void ParquetGetSegFileDataLocation(Relation relation, pg_parquetseg_dsc = RelationGetDescr(pg_parquetseg_rel); parquetscan = systable_beginscan(pg_parquetseg_rel, InvalidOid, FALSE, metadataSnapshot, 0, NULL); + + // get targetPolicy + GpPolicy *targetPolicy = NULL; + Oid myrelid = rel_data->relid; + targetPolicy = GpPolicyFetch(CurrentMemoryContext, myrelid); + while (HeapTupleIsValid(tuple = systable_getnext(parquetscan))) { BlockLocation *locations; int block_num; @@ -1432,9 +1440,6 @@ static void ParquetGetSegFileDataLocation(Relation relation, fastgetattr(tuple, Anum_pg_parquetseg_eof, pg_parquetseg_dsc, NULL)); bool isRelationHash = true; - GpPolicy *targetPolicy = NULL; - Oid myrelid = rel_data->relid; - targetPolicy = GpPolicyFetch(CurrentMemoryContext, myrelid); if (targetPolicy->nattrs == 0) { isRelationHash = false; }