You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/02/26 06:21:39 UTC

(cloudberry) 06/08: Fix duplicate index records of view pg_stat_all_indexes

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 29a36f869c913cc68b09e8663fa03abd45961fee
Author: eedy <cq...@gmail.com>
AuthorDate: Tue Apr 4 16:22:06 2023 +0800

    Fix duplicate index records of view pg_stat_all_indexes
    
    view pg_stat_all_indexes will produce duplicate index records when a
    table has multiple indexes. add indexrelid predicate for view to get
    rid of this.
    
    only one record for each index from document:
    "The pg_stat_all_indexes view shows one row for each index in the
    current database that displays statistics about accesses to that
    specific index."
---
 src/backend/catalog/system_views.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 23a936ca9b..6b0b604ab5 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -911,7 +911,7 @@ FROM
          pg_stat_all_indexes_internal
      WHERE
              relid < 16384) m, pg_stat_all_indexes_internal s
-WHERE m.relid = s.relid;
+WHERE m.indexrelid = s.indexrelid;
 
 CREATE VIEW pg_stat_sys_indexes AS
     SELECT * FROM pg_stat_all_indexes


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org