!3637 修复pg_stat_系列函数无法获取分区信息
Merge pull request !3637 from xiyanziran/master-pgstat_part
This commit is contained in:
@ -711,6 +711,9 @@ void pg_stat_get_stat_list(List** stat_list, uint32* statFlag_ref, Oid relid)
|
||||
} else if (isPartitionedObject(relid, RELKIND_INDEX, true)) {
|
||||
*statFlag_ref = relid;
|
||||
*stat_list = getPartitionObjectIdList(relid, PART_OBJ_TYPE_INDEX_PARTITION);
|
||||
} else if (isPartitionObject(relid, PART_OBJ_TYPE_TABLE_PARTITION, true)) {
|
||||
*statFlag_ref = partid_get_parentid(relid);
|
||||
*stat_list = list_make1_oid(relid);
|
||||
} else {
|
||||
*statFlag_ref = InvalidOid;
|
||||
*stat_list = list_make1_oid(relid);
|
||||
|
||||
@ -306,6 +306,26 @@ select * from test_index_ht order by 1;
|
||||
6 | |
|
||||
(4 rows)
|
||||
|
||||
create table tab_hash(c1 number, c2 number,c3 varchar2(20)) partition by hash(c2)(
|
||||
partition p1,
|
||||
partition p2,
|
||||
partition p3,
|
||||
partition p4,
|
||||
partition p5
|
||||
);
|
||||
insert into tab_hash select t,t,t from generate_series(1,10) t;
|
||||
analyse tab_hash;
|
||||
select relname, pg_stat_get_live_tuples(oid) live_tuples from pg_partition
|
||||
where parentid='tab_hash'::regclass and parttype='p' order by relname;
|
||||
relname | live_tuples
|
||||
---------+-------------
|
||||
p1 | 3
|
||||
p2 | 2
|
||||
p3 | 2
|
||||
p4 | 2
|
||||
p5 | 1
|
||||
(5 rows)
|
||||
|
||||
drop table test_index_ht;
|
||||
drop schema fvt_other_cmd cascade;
|
||||
NOTICE: drop cascades to table fvt_other_cmd.idex_list_partition_table_001
|
||||
|
||||
@ -169,5 +169,18 @@ set enable_seqscan = off;
|
||||
set enable_bitmapscan = off;
|
||||
explain (costs off, verbose on) select * from test_index_ht order by 1;
|
||||
select * from test_index_ht order by 1;
|
||||
|
||||
create table tab_hash(c1 number, c2 number,c3 varchar2(20)) partition by hash(c2)(
|
||||
partition p1,
|
||||
partition p2,
|
||||
partition p3,
|
||||
partition p4,
|
||||
partition p5
|
||||
);
|
||||
insert into tab_hash select t,t,t from generate_series(1,10) t;
|
||||
analyse tab_hash;
|
||||
select relname, pg_stat_get_live_tuples(oid) live_tuples from pg_partition
|
||||
where parentid='tab_hash'::regclass and parttype='p' order by relname;
|
||||
|
||||
drop table test_index_ht;
|
||||
drop schema fvt_other_cmd cascade;
|
||||
|
||||
Reference in New Issue
Block a user