
# PGXC_GET_STAT_ALL_PARTITIONS
PGXC_GET_STAT_ALL_PARTITIONS视图获取各分区表分区的插入、更新、删除以及脏页率信息。
该视图的统计信息依赖于ANALYZE，为获取最准确的信息请先对分区表进行ANALYZE。
![](https://support.huaweicloud.com/devg-dws/public_sys-resources/note_3.0-zh-cn.png)
8.2.0及以上集群版本，查询脏页率推荐使用[PGXC_STAT_TABLE_DIRTY](https://support.huaweicloud.com/devg-dws/dws_04_1046.html)。
表1PGXC_GET_STAT_ALL_PARTITIONS字段 
| 名称              | 类型           | 描述          |
|:---|:---|:---|
| relid           | oid          | 表的OID。      |
| partid          | oid          | 分区的OID。     |
| schemaname      | name         | 表的模式名。      |
| relname         | name         | 表名。         |
| partname        | name         | 分区名。        |
| n_tup_ins       | numeric      | 插入的元组条数。    |
| n_tup_upd       | numeric      | 更新的元组条数。    |
| n_tup_del       | numeric      | 删除的元组条数。    |
| n_live_tup      | numeric      | live元组的条数。  |
| n_dead_tup      | numeric      | dead元组的条数。  |
| page_dirty_rate | numeric(5,2) | 表的脏页率信息(%)。 |
   
#### 应用示例
查询数据库内脏页率大于30%的分区表：
```
SELECT * FROM PGXC_GET_STAT_ALL_PARTITIONS WHERE dirty_page_rate>30;
 relid | partid |   schemaname    |      relname       | partname | n_tup_ins | n_tup_upd | n_tup_del | n_live_tup | n_dead_tup | dirty_page_rate
-------+--------+-----------------+--------------------+----------+-----------+-----------+-----------+------------+------------+-----------------
 58320 |  58626 | schema_subquery | store_hash_par     | p1       |         2 |         0 |         2 |          0 |          2 |          100.00
 58430 |  58706 | schema_subquery | store_hash_par_mor | p4       |         1 |         1 |         1 |          0 |          2 |          100.00
 58320 |  58644 | schema_subquery | store_hash_par     | p1       |         3 |         0 |         3 |          0 |          3 |          100.00
 58430 |  58770 | schema_subquery | store_hash_par_mor | p4       |         1 |         1 |         1 |          0 |          2 |          100.00
 58320 |  58643 | schema_subquery | store_hash_par     | p1       |         2 |         0 |         2 |          0 |          2 |          100.00
 58320 |  58625 | schema_subquery | store_hash_par     | p1       |         2 |         0 |         2 |          0 |          2 |          100.00
 58320 |  58579 | schema_subquery | store_hash_par     | p1       |         2 |         0 |         2 |          0 |          2 |          100.00
 58320 |  58619 | schema_subquery | store_hash_par     | p1       |         3 |         0 |         3 |          0 |          3 |          100.00
 58320 |  58627 | schema_subquery | store_hash_par     | p1       |         4 |         0 |         4 |          0 |          4 |          100.00
 58320 |  58657 | schema_subquery | store_hash_par     | p1       |         3 |         0 |         3 |          0 |          3 |          100.00
(10 rows)
```
