This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 5142c0e8afe0c8e6640c8157c067e1e25d20b0a5
Author: Huansong Fu <[email protected]>
AuthorDate: Mon Mar 20 14:29:50 2023 -0700

    Fix names of pg_stat_all_tables|indexes
    
    We used to not have a very clear naming guideline for the existing
    'pg_%' system views and the MPP versions of them. As an example,
    we renamed PG's pg_stat_all_tables and pg_stat_all_indexes to have
    an '_internal' appendix, and used their original names to collect
    aggregated results from all segments (commit e6f93033289e).
    
    However, with the previous commit, we now let all existing PG system
    views to have their original names, while add corresponding 'gp_%'
    views for the non-aggregated results from all segments, and
    'gp_%_summary' views for aggregated results from all segments.
    
    Therefore, we now revert pg_stat_all_tables and pg_stat_all_indexes
    back to their original definitions, which just collect stats from
    a single segment. Then, we add them to sytem_views_gp.in to produce
    gp_stat_all_tables and gp_stat_all_indexes which collect non-aggregated
    results from all segments. Finally, we rename the aggregate version of
    those views to be gp_stat_all_tables_summary and 
gp_stat_all_indexes_summary.
    
    Because views pg_stat_user_tables and pg_stat_user_indexes use the above
    sumary views, we have to add _summary views for these two views as well.
    We will add _summary for other system views later.
    
    Modify regress test accordingly.
---
 src/backend/catalog/system_views.sql             | 34 +++++++----
 src/backend/catalog/system_views_gp.in           |  2 +
 src/test/regress/expected/pg_stat.out            | 16 ++---
 src/test/regress/input/pgstat_qd_tabstat.source  | 76 ++++++++++++------------
 src/test/regress/output/pgstat_qd_tabstat.source | 76 ++++++++++++------------
 src/test/regress/sql/pg_stat.sql                 | 16 ++---
 6 files changed, 116 insertions(+), 104 deletions(-)

diff --git a/src/backend/catalog/system_views.sql 
b/src/backend/catalog/system_views.sql
index d5b7b81e8a2..4b8c9c0df43 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -660,7 +660,7 @@ REVOKE EXECUTE ON FUNCTION pg_get_backend_memory_contexts() 
FROM PUBLIC;
 
 -- Statistics views
 
-CREATE VIEW pg_stat_all_tables_internal AS
+CREATE VIEW pg_stat_all_tables AS
     SELECT
             C.oid AS relid,
             N.nspname AS schemaname,
@@ -694,7 +694,7 @@ CREATE VIEW pg_stat_all_tables_internal AS
 
 -- Gather data from segments on user tables, and use data on coordinator on 
system tables.
 
-CREATE VIEW pg_stat_all_tables AS
+CREATE VIEW gp_stat_all_tables_summary AS
 SELECT
     s.relid,
     s.schemaname,
@@ -745,7 +745,7 @@ FROM
          max(analyze_count) as analyze_count,
          max(autoanalyze_count) as autoanalyze_count
      FROM
-         gp_dist_random('pg_stat_all_tables_internal') allt
+         gp_dist_random('pg_stat_all_tables') allt
          inner join pg_class c
                on allt.relid = c.oid
          left outer join gp_distribution_policy d
@@ -763,9 +763,9 @@ FROM
      SELECT
          *
      FROM
-         pg_stat_all_tables_internal
+         pg_stat_all_tables
      WHERE
-             relid < 16384) m, pg_stat_all_tables_internal s
+             relid < 16384) m, pg_stat_all_tables s
 WHERE m.relid = s.relid;
 
 CREATE VIEW pg_stat_xact_all_tables AS
@@ -815,7 +815,12 @@ CREATE VIEW pg_stat_user_tables AS
 -- since we don't have segments.
 -- We create a new view for single node mode.
 CREATE VIEW pg_stat_user_tables_single_node AS
-    SELECT * FROM pg_stat_all_tables_internal
+    SELECT * FROM pg_stat_all_tables
+    WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
+          schemaname !~ '^pg_toast';
+
+CREATE VIEW gp_stat_user_tables_summary AS
+    SELECT * FROM gp_stat_all_tables_summary
     WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
           schemaname !~ '^pg_toast';
 
@@ -859,7 +864,7 @@ CREATE VIEW pg_statio_user_tables AS
     WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
           schemaname !~ '^pg_toast';
 
-CREATE VIEW pg_stat_all_indexes_internal AS
+CREATE VIEW pg_stat_all_indexes AS
     SELECT
             C.oid AS relid,
             I.oid AS indexrelid,
@@ -877,7 +882,7 @@ CREATE VIEW pg_stat_all_indexes_internal AS
 
 -- Gather data from segments on user tables, and use data on coordinator on 
system tables.
 
-CREATE VIEW pg_stat_all_indexes AS
+CREATE VIEW gp_stat_all_indexes_summary AS
 SELECT
     s.relid,
     s.indexrelid,
@@ -898,7 +903,7 @@ FROM
          sum(idx_tup_read) as idx_tup_read,
          sum(idx_tup_fetch) as idx_tup_fetch
      FROM
-         gp_dist_random('pg_stat_all_indexes_internal')
+         gp_dist_random('pg_stat_all_indexes')
      WHERE
              relid >= 16384
      GROUP BY relid, indexrelid, schemaname, relname, indexrelname
@@ -908,10 +913,10 @@ FROM
      SELECT
          *
      FROM
-         pg_stat_all_indexes_internal
+         pg_stat_all_indexes
      WHERE
-             relid < 16384) m, pg_stat_all_indexes_internal s
-WHERE m.indexrelid = s.indexrelid;
+             relid < 16384) m, pg_stat_all_indexes s
+WHERE m.relid = s.relid;
 
 CREATE VIEW pg_stat_sys_indexes AS
     SELECT * FROM pg_stat_all_indexes
@@ -923,6 +928,11 @@ CREATE VIEW pg_stat_user_indexes AS
     WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
           schemaname !~ '^pg_toast';
 
+CREATE VIEW gp_stat_user_indexes_summary AS
+    SELECT * FROM gp_stat_all_indexes_summary
+    WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
+          schemaname !~ '^pg_toast';
+
 CREATE VIEW pg_statio_all_indexes AS
     SELECT
             C.oid AS relid,
diff --git a/src/backend/catalog/system_views_gp.in 
b/src/backend/catalog/system_views_gp.in
index d46dde3191e..cd865cea662 100644
--- a/src/backend/catalog/system_views_gp.in
+++ b/src/backend/catalog/system_views_gp.in
@@ -9,6 +9,8 @@ pg_replication_origin_status
 pg_replication_slots
 pg_settings
 pg_stat_activity
+pg_stat_all_indexes
+pg_stat_all_tables
 pg_stat_archiver
 pg_stat_bgwriter
 #pg_stat_database
diff --git a/src/test/regress/expected/pg_stat.out 
b/src/test/regress/expected/pg_stat.out
index 80e4e4ff132..8c2b2e81d32 100644
--- a/src/test/regress/expected/pg_stat.out
+++ b/src/test/regress/expected/pg_stat.out
@@ -5,7 +5,7 @@ create table pg_stat_test(a int);
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
  schemaname |   relname    | seq_scan | seq_tup_read | idx_scan | 
idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup 
| n_dead_tup 
 
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------
  public     | pg_stat_test |        0 |            0 |          |              
 |         0 |         0 |         0 |             0 |          0 |          0
@@ -14,7 +14,7 @@ from pg_stat_all_tables where relname = 'pg_stat_test';
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
  schemaname |   relname    | seq_scan | seq_tup_read | idx_scan | 
idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup 
| n_dead_tup 
 
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------
  public     | pg_stat_test |        0 |            0 |          |              
 |         0 |         0 |         0 |             0 |          0 |          0
@@ -22,14 +22,14 @@ from pg_stat_user_tables where relname = 'pg_stat_test';
 
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
  schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch 
 ------------+---------+--------------+----------+--------------+---------------
 (0 rows)
 
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
  schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch 
 ------------+---------+--------------+----------+--------------+---------------
 (0 rows)
@@ -63,7 +63,7 @@ reset enable_seqscan;
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
  schemaname |   relname    | seq_scan | seq_tup_read | idx_scan | 
idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup 
| n_dead_tup | n_mod_since_analyze 
 
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------
  public     | pg_stat_test |       12 |          391 |        1 |             
0 |       110 |         0 |        19 |             0 |         91 |         19 
|                 129
@@ -72,7 +72,7 @@ from pg_stat_all_tables where relname = 'pg_stat_test';
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
  schemaname |   relname    | seq_scan | seq_tup_read | idx_scan | 
idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup 
| n_dead_tup | n_mod_since_analyze 
 
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------
  public     | pg_stat_test |       12 |          391 |        1 |             
0 |       110 |         0 |        19 |             0 |         91 |         19 
|                 129
@@ -80,7 +80,7 @@ from pg_stat_user_tables where relname = 'pg_stat_test';
 
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
  schemaname |   relname    |       indexrelname       | idx_scan | 
idx_tup_read | idx_tup_fetch 
 
------------+--------------+--------------------------+----------+--------------+---------------
  public     | pg_stat_test | pg_stat_user_table_index |        1 |            
1 |             0
@@ -88,7 +88,7 @@ from pg_stat_all_indexes where relname = 'pg_stat_test';
 
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
  schemaname |   relname    |       indexrelname       | idx_scan | 
idx_tup_read | idx_tup_fetch 
 
------------+--------------+--------------------------+----------+--------------+---------------
  public     | pg_stat_test | pg_stat_user_table_index |        1 |            
1 |             0
diff --git a/src/test/regress/input/pgstat_qd_tabstat.source 
b/src/test/regress/input/pgstat_qd_tabstat.source
index 0fb8c0ccb71..e9f76ccf0d6 100644
--- a/src/test/regress/input/pgstat_qd_tabstat.source
+++ b/src/test/regress/input/pgstat_qd_tabstat.source
@@ -10,7 +10,7 @@ copy table_for_docopy (i, j) from stdin;
 3      hello3
 \.
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_docopy'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_docopy'::regclass;
 
 CREATE TABLE data_tbl (a int,b char) distributed by (a);
 INSERT INTO data_tbl values(1,'1');
@@ -21,7 +21,7 @@ COPY data_tbl TO '/tmp/data_tbl<SEGID>.csv' on segment;
 create table copy_on_segment (a int,b char);
 COPY copy_on_segment from '/tmp/data_tbl<SEGID>.csv' on segment log errors 
segment reject limit 3 rows;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'copy_on_segment'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'copy_on_segment'::regclass;
 
 
 -- Test pgstat table stat in initplan on QD
@@ -34,26 +34,26 @@ copy table_for_initplan (i, j, k) from stdin;
 explain (costs off) with updated AS (update table_for_initplan set k = 33 
where i = 3 returning k) select table_for_initplan.*, (select sum(k) from 
updated) from table_for_initplan;
 with updated AS (update table_for_initplan set k = 33 where i = 3 returning k) 
select table_for_initplan.*, (select sum(k) from updated) from 
table_for_initplan;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_initplan'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_initplan'::regclass;
 
 
 -- Test pgstat table stat in CTAS on QD
 create table table_for_ctas with (autovacuum_enabled=false) as select i, 
'hello' || i from generate_series(1, 100) f(i);
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_ctas'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_ctas'::regclass;
 select i, 'hello' || i into table_for_insert_into from generate_series(1, 100) 
f(i);
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_insert_into'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_insert_into'::regclass;
 
 
 -- Test pgstat table stat in ALTER TABLE SET DISTRIBUTED BY on QD
 create table table_for_set_distributed_by(i int, j varchar) distributed by (i);
 insert into table_for_set_distributed_by select i, 'hello' || i from 
generate_series(1, 333) f(i);
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_set_distributed_by'::regclass;
 alter table table_for_set_distributed_by set distributed by (j);
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_set_distributed_by'::regclass;
 
 
 -- Test pgstat table stat in execution of funciton on QD
@@ -68,7 +68,7 @@ $$
 language plpgsql volatile;
 select update_table_for_function();
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_function'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_function'::regclass;
 
 
 -- Test pgstat table stat in ALTER TABLE EXPAND TABLE on QD;
@@ -78,11 +78,11 @@ create table table_for_expand(i int, j varchar) distributed 
by (i);
 insert into table_for_expand select i, 'hello' || i from generate_series(1, 
333) f(i);
 select count(distinct gp_segment_id) from table_for_expand;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_expand'::regclass;
 alter table table_for_expand expand table;
 select count(distinct gp_segment_id) from table_for_expand;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_expand'::regclass;
 select gp_debug_reset_create_table_default_numsegments();
 
 
@@ -103,7 +103,7 @@ update table_for_iud set j = 'heroes never die' where i >= 
300;
 release savepoint level3;
 commit;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_iud'::regclass;
 
 begin;
 savepoint level1;
@@ -120,14 +120,14 @@ rollback to savepoint level3;
 delete from table_for_iud where i <= 200;
 commit;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_iud'::regclass;
 
 
 -- Test pgstat table stat in TRUNCATE on QD
 create table table_for_truncate(i int, j varchar) distributed by (i);
 insert into table_for_truncate select i, 'hello' || i from generate_series(1, 
777) f(i);
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_truncate'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_truncate'::regclass;
 begin;
 savepoint level1;
 savepoint level2;
@@ -141,12 +141,12 @@ delete from table_for_truncate where i >= 700;
 update table_for_truncate set j = 'D' where i <= 200;
 commit;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_truncate'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_truncate'::regclass;
 
 create table table_for_truncate_abort(i int, j varchar) distributed by (i);
 insert into table_for_truncate_abort select i, 'hello' || i from 
generate_series(1, 777) f(i);
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_truncate_abort'::regclass;
 begin;
 savepoint level1;
 savepoint level2;
@@ -160,7 +160,7 @@ delete from table_for_truncate_abort where i < 700;
 update table_for_truncate_abort set j = 'D' where i >= 200;
 rollback;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_truncate_abort'::regclass;
 
 
 -- Test pgstat table stat for partition table on QD
@@ -171,17 +171,17 @@ PARTITION BY RANGE (rank)
   DEFAULT PARTITION extra );
 insert into rankpart select i, i % 10, i from generate_series(1, 1000)i;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
 
 begin;
 delete from rankpart where id <= 100;
 rollback;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
 
 copy rankpart (id, rank, product) from stdin;
 1001   1       1001
@@ -196,8 +196,8 @@ copy rankpart (id, rank, product) from stdin;
 1010   6       1010
 \.
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
 
 begin;
 update rankpart set rank = 1 where id > 1005;
@@ -209,9 +209,9 @@ release savepoint level2;
 rollback to savepoint level1;
 commit;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
 
 begin;
 savepoint level1_1;
@@ -219,9 +219,9 @@ insert into rankpart select i, i % 10, i from 
generate_series(2001, 3000)i;
 insert into rankpart select i, i % 10, i from generate_series(3001, 4000)i;
 commit;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
 
 
 -- Test pgstat matview stat with distributed policy.
@@ -229,11 +229,11 @@ create table base_table(i int, j int, z int ) distributed 
by (i);
 insert into base_table select i,i,i from generate_series(1, 100) i;
 create materialized view mt as select * from base_table where z>=50;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
 insert into base_table select i,i,i from generate_series(1, 100) i;
 refresh materialized view mt;
 select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force 
pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
 -- pg_stat_all_tables collects gpstats across segments
 select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
 
@@ -245,11 +245,11 @@ create table base_table(i int, j int, z int ) distributed 
replicated;
 insert into base_table select i,i,i from generate_series(1, 100) i;
 create materialized view mt as select * from base_table where z>=50 
distributed replicated;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
 insert into base_table select i,i,i from generate_series(1, 100) i;
 refresh materialized view mt;
 select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force 
pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
 -- pg_stat_all_tables collects gpstats across segments
 select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
 
@@ -263,15 +263,15 @@ insert into tabstat_ao select 1,1;
 delete from tabstat_ao;
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
 
-select count(*) from pg_stat_all_tables
+select count(*) from gp_stat_all_tables_summary
 where
     relid = (select segrelid from pg_appendonly where relid = 
'tabstat_ao'::regclass)
     OR relid = (select blkdirrelid from pg_appendonly where relid = 
'tabstat_ao'::regclass)
     OR relid = (select visimaprelid from pg_appendonly where relid = 
'tabstat_ao'::regclass);
 
 select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins from pg_stat_all_tables where relid = (select segrelid from 
pg_appendonly where relid = 'tabstat_ao'::regclass);
-select n_tup_ins from pg_stat_all_tables where relid = (select blkdirrelid 
from pg_appendonly where relid = 'tabstat_ao'::regclass);
-select n_tup_ins from pg_stat_all_tables where relid = (select visimaprelid 
from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select 
segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select 
blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select 
visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
 
 drop table tabstat_ao;
diff --git a/src/test/regress/output/pgstat_qd_tabstat.source 
b/src/test/regress/output/pgstat_qd_tabstat.source
index ca612e18b9c..591f262f7c5 100644
--- a/src/test/regress/output/pgstat_qd_tabstat.source
+++ b/src/test/regress/output/pgstat_qd_tabstat.source
@@ -10,7 +10,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send 
tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_docopy'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_docopy'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
          3 |         0 |         0 |             0 |          3 |          0 | 
                  3
@@ -32,7 +32,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send 
tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'copy_on_segment'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'copy_on_segment'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
          4 |         0 |         0 |             0 |          4 |          0 | 
                  4
@@ -70,7 +70,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send 
tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_initplan'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_initplan'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
          3 |         1 |         0 |             0 |          3 |          1 | 
                  4
@@ -86,7 +86,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send 
tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_ctas'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_ctas'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        100 |         0 |         0 |             0 |        100 |          0 | 
                100
@@ -101,7 +101,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_insert_into'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_insert_into'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        100 |         0 |         0 |             0 |        100 |          0 | 
                100
@@ -116,7 +116,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_set_distributed_by'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        333 |         0 |         0 |             0 |        333 |          0 | 
                333
@@ -129,7 +129,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_set_distributed_by'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        333 |         0 |         0 |             0 |        333 |          0 | 
                333
@@ -157,7 +157,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_function'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_function'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        333 |         0 |       200 |             0 |        133 |        200 | 
                533
@@ -185,7 +185,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_expand'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        333 |         0 |         0 |             0 |        333 |          0 | 
                333
@@ -204,7 +204,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_expand'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        333 |         0 |         0 |             0 |        333 |          0 | 
                333
@@ -238,7 +238,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_iud'::regclass;
  n_live_tup | n_dead_tup 
 ------------+------------
         333 |         34
@@ -264,7 +264,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_iud'::regclass;
  n_live_tup | n_dead_tup 
 ------------+------------
         133 |        713
@@ -279,7 +279,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'table_for_truncate'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'table_for_truncate'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        777 |         0 |         0 |             0 |        777 |          0 | 
                777
@@ -303,7 +303,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_truncate'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_truncate'::regclass;
  n_live_tup | n_dead_tup 
 ------------+------------
         699 |        301
@@ -317,7 +317,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_truncate_abort'::regclass;
  n_live_tup | n_dead_tup 
 ------------+------------
         777 |          0
@@ -341,7 +341,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 
'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 
'table_for_truncate_abort'::regclass;
  n_live_tup | n_dead_tup 
 ------------+------------
         777 |        223
@@ -360,19 +360,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        500 |         0 |         0 |             0 |        500 |          0 | 
                500
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        400 |         0 |         0 |             0 |        400 |          0 | 
                400
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        100 |         0 |         0 |             0 |        100 |          0 | 
                100
@@ -387,19 +387,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        500 |         0 |        50 |             0 |        500 |          0 | 
                500
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        400 |         0 |        40 |             0 |        400 |          0 | 
                400
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        100 |         0 |        10 |             0 |        100 |          0 | 
                100
@@ -412,13 +412,13 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        505 |         0 |        50 |             0 |        505 |          0 | 
                505
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        405 |         0 |        40 |             0 |        405 |          0 | 
                405
@@ -439,19 +439,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        510 |         0 |        55 |             0 |        510 |          0 | 
                510
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        410 |         0 |        50 |             0 |        400 |         10 | 
                410
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        100 |         0 |        10 |             0 |        100 |          0 | 
                100
@@ -468,19 +468,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_2'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
       1510 |         0 |        55 |             0 |       1510 |          0 | 
               1510
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_3'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
       1210 |         0 |        50 |             0 |       1200 |         10 | 
               1210
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 
'rankpart_1_prt_extra'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        300 |         0 |        10 |             0 |        300 |          0 | 
                300
@@ -498,7 +498,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
         51 |         0 |         0 |             0 |         51 |          0 | 
                 51
@@ -514,7 +514,7 @@ select pg_sleep(0.77) from gp_dist_random('gp_id'); -- 
Force pgstat_report_stat(
  
 (3 rows)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        153 |         0 |         0 |             0 |        102 |          0 | 
                153
@@ -539,7 +539,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
         51 |         0 |         0 |             0 |         51 |          0 | 
                 51
@@ -555,7 +555,7 @@ select pg_sleep(0.77) from gp_dist_random('gp_id'); -- 
Force pgstat_report_stat(
  
 (3 rows)
 
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables_internal where relid = 
'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, 
n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
  n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | 
n_mod_since_analyze 
 
-----------+-----------+-----------+---------------+------------+------------+---------------------
        153 |         0 |         0 |             0 |        102 |          0 | 
                153
@@ -580,7 +580,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select count(*) from pg_stat_all_tables
+select count(*) from gp_stat_all_tables_summary
 where
     relid = (select segrelid from pg_appendonly where relid = 
'tabstat_ao'::regclass)
     OR relid = (select blkdirrelid from pg_appendonly where relid = 
'tabstat_ao'::regclass)
@@ -596,19 +596,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to 
send tabstat.
  
 (1 row)
 
-select n_tup_ins from pg_stat_all_tables where relid = (select segrelid from 
pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select 
segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
  n_tup_ins 
 -----------
          1
 (1 row)
 
-select n_tup_ins from pg_stat_all_tables where relid = (select blkdirrelid 
from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select 
blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
  n_tup_ins 
 -----------
          1
 (1 row)
 
-select n_tup_ins from pg_stat_all_tables where relid = (select visimaprelid 
from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select 
visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
  n_tup_ins 
 -----------
          1
diff --git a/src/test/regress/sql/pg_stat.sql b/src/test/regress/sql/pg_stat.sql
index d9fc37850b0..383a9149186 100644
--- a/src/test/regress/sql/pg_stat.sql
+++ b/src/test/regress/sql/pg_stat.sql
@@ -6,17 +6,17 @@ create table pg_stat_test(a int);
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
 
 begin; -- make analyze same transcation with insert to avoid double the pgstat 
causes by unorder message read.
 insert into pg_stat_test select * from generate_series(1, 100);
@@ -42,17 +42,17 @@ reset enable_seqscan;
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
 select
     schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, 
n_tup_ins, n_tup_upd,
     n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
 select
     schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
 
 reset optimizer;
 reset max_parallel_workers_per_gather;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to