diff options
Diffstat (limited to 'contrib/pgstattuple/pgstatindex.c')
-rw-r--r-- | contrib/pgstattuple/pgstatindex.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c index a2ea5d709cf..8d9d81610ec 100644 --- a/contrib/pgstattuple/pgstatindex.c +++ b/contrib/pgstattuple/pgstatindex.c @@ -78,7 +78,6 @@ typedef struct BTIndexStat uint32 level; BlockNumber root_blkno; - uint64 root_pages; uint64 internal_pages; uint64 leaf_pages; uint64 empty_pages; @@ -184,7 +183,6 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) } /* -- init counters -- */ - indexStat.root_pages = 0; indexStat.internal_pages = 0; indexStat.leaf_pages = 0; indexStat.empty_pages = 0; @@ -217,7 +215,11 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) /* Determine page type, and update totals */ - if (P_ISLEAF(opaque)) + if (P_ISDELETED(opaque)) + indexStat.deleted_pages++; + else if (P_IGNORE(opaque)) + indexStat.empty_pages++; /* this is the "half dead" state */ + else if (P_ISLEAF(opaque)) { int max_avail; @@ -234,12 +236,6 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno) indexStat.fragments++; } - else if (P_ISDELETED(opaque)) - indexStat.deleted_pages++; - else if (P_IGNORE(opaque)) - indexStat.empty_pages++; - else if (P_ISROOT(opaque)) - indexStat.root_pages++; else indexStat.internal_pages++; @@ -268,7 +264,7 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) values[j++] = psprintf("%d", indexStat.version); values[j++] = psprintf("%d", indexStat.level); values[j++] = psprintf(INT64_FORMAT, - (indexStat.root_pages + + (1 + /* include the metapage in index_size */ indexStat.leaf_pages + indexStat.internal_pages + indexStat.deleted_pages + |