* Collect statistics of single b-tree leaf page
* -------------------------------------------------
*/
-static bool
+static void
GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat * stat)
{
Page page = BufferGetPage(buffer);
stat->max_avail = BLCKSZ - (BLCKSZ - phdr->pd_special + SizeOfPageHeaderData);
stat->dead_items = stat->live_items = 0;
+ stat->fragments = 0;
stat->page_size = PageGetPageSize(page);
if (P_ISDELETED(opaque))
{
stat->type = 'd';
- return true;
+ stat->btpo.xact = opaque->btpo.xact;
+ return;
}
else if (P_IGNORE(opaque))
stat->type = 'e';
/* btpage opaque data */
stat->btpo_prev = opaque->btpo_prev;
stat->btpo_next = opaque->btpo_next;
- if (P_ISDELETED(opaque))
- stat->btpo.xact = opaque->btpo.xact;
- else
- stat->btpo.level = opaque->btpo.level;
+ stat->btpo.level = opaque->btpo.level;
stat->btpo_flags = opaque->btpo_flags;
stat->btpo_cycleid = opaque->btpo_cycleid;
* it means a fragmentation.
*----------------------------------------------
*/
- stat->fragments = 0;
if (stat->type == 'l')
{
if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno)
stat->avg_item_size = item_size / (stat->live_items + stat->dead_items);
else
stat->avg_item_size = 0;
-
- return true;
}
int j;
char *values[PGSTATINDEX_NCOLUMNS];
- HeapTupleData tupleData;
- HeapTuple tuple = &tupleData;
+ HeapTuple tuple;
tupleDesc = RelationNameGetTupleDesc(PGSTATINDEX_TYPE);