Re: Add pgstathashindex() to get hash index table statistics.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pgstathashindex() to get hash index table statistics.
Date: 2017-04-05 19:30:48
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Thu, Mar 23, 2017 at 1:54 PM, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> wrote:
>> Yeah, but I think "unused" might be better. Because a page could be
>> in use (as an overflow page or primary bucket page) and still be
>> empty.
> Based on the earlier discussions, I have prepared a patch that would
> allow pgstathashindex() to show the number of unused pages in hash
> index. Please find the attached patch for the same. Thanks.

My idea is that we shouldn't end up with both a zero_pages column and
an unused_pages column. Instead, we should end up with just an
unused_pages column, which will include both pages that are all-zeroes
and pages that have a valid special space marked as LH_UNUSED.

Also, I don't see why it's correct to test PageIsEmpty() here instead
of just testing the page type as we do in pageinspect.

Attached is a revised patch that shows what I have in mind; please
review. Along the way I made the code for examining the page type
more similar to what pageinspect does, because I see no reason for
those things to be different, and I think the pageinspect code is

Robert Haas
The Enterprise PostgreSQL Company

Attachment Content-Type Size
pgstathashindex-empty.patch application/octet-stream 4.9 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-04-05 19:36:05 Re: Patch: Write Amplification Reduction Method (WARM)
Previous Message Tels 2017-04-05 19:19:04 Re: multivariate statistics (v25)