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

Kuntal Ghosh <kuntalghosh.2007@gmail.com>

From: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-01-23T15:58:32Z
Lists: pgsql-hackers
On Mon, Jan 23, 2017 at 2:56 PM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> Hi,
>
> Please find the attached v4 patch rebased on a latest commitID in
> head. I had to rebase it as the following git commit has some changes
> in pgstatindex.c file due to which 'git apply' was failing.
>
I've looked at the patch. It looks good. However, I was wondering why
an exclusive lock for extension is necessary for reading the number
blocks in this case. Please refer to the following code.

+       /* Get the current relation length */
+       LockRelationForExtension(rel, ExclusiveLock);
+       nblocks = RelationGetNumberOfBlocks(rel);
+       UnlockRelationForExtension(rel, ExclusiveLock);

Apart from this, I've nothing else to add.

-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com


Commits

  1. Fix pgstattuple's handling of unused hash pages.

  2. Move some things from builtins.h to new header files