From 8cb066f9dd55183592f89335e02be0ffaebb64d1 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Tue, 20 May 2014 00:31:04 +0400 Subject: [PATCH] add usedInnerSpace/usedLeafSpace for spgist --- gevel.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gevel.c b/gevel.c index b4e66f4..0e14761 100644 --- a/gevel.c +++ b/gevel.c @@ -891,7 +891,9 @@ spgist_stat(PG_FUNCTION_ARGS) leafPages = 0, emptyPages = 0, deletedPages = 0; - double usedSpace = 0.0; + double usedSpace = 0.0, + usedLeafSpace = 0.0, + usedInnerSpace = 0.0; char res[1024]; int bufferSize = -1; int64 innerTuples = 0, @@ -968,6 +970,10 @@ spgist_stat(PG_FUNCTION_ARGS) pageFree = PageGetExactFreeSpace(page); usedSpace += bufferSize - pageFree; + if (SpGistPageIsLeaf(page)) + usedLeafSpace += bufferSize - pageFree; + else + usedInnerSpace += bufferSize - pageFree; if (pageFree == bufferSize) emptyPages++; @@ -986,6 +992,8 @@ spgist_stat(PG_FUNCTION_ARGS) "leafPages: %u\n" "emptyPages: %u\n" "usedSpace: %.2f kbytes\n" + "usedInnerSpace: %.2f kbytes\n" + "usedLeafSpace: %.2f kbytes\n" "freeSpace: %.2f kbytes\n" "fillRatio: %.2f%%\n" "leafTuples: " INT64_FORMAT "\n" @@ -997,6 +1005,8 @@ spgist_stat(PG_FUNCTION_ARGS) "innerRedirects: " INT64_FORMAT, totalPages, deletedPages, innerPages, leafPages, emptyPages, usedSpace / 1024.0, + usedInnerSpace / 1024.0, + usedLeafSpace / 1024.0, (((double) bufferSize) * ((double) totalPages) - usedSpace) / 1024, 100.0 * (usedSpace / (((double) bufferSize) * ((double) totalPages))), leafTuples, innerTuples, nAllTheSame, -- 2.46.1