Re: Microvacuum support for Hash Index

Jesper Pedersen <jesper.pedersen@redhat.com>

From: Jesper Pedersen <jesper.pedersen@redhat.com>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2016-11-03T18:00:33Z
Lists: pgsql-hackers
Hi,

On 11/02/2016 01:38 AM, Ashutosh Sharma wrote:
>> While replaying the delete/vacuum record on standby, it can conflict
>> with some already running queries.  Basically the replay can remove
>> some row which can be visible on standby.  You need to resolve
>> conflicts similar to what we do in btree delete records (refer
>> btree_xlog_delete).
>
> Agreed. Thanks for putting this point. I have taken care of it in the
> attached v2 patch.
>

Some initial comments.

_hash_vacuum_one_page:

+		END_CRIT_SECTION();
+		_hash_chgbufaccess(rel, metabuf, HASH_READ, HASH_NOLOCK);

The _hash_chgbufaccess() needs a comment.

You also need a place where you call pfree for so->killedItems - maybe 
in hashkillitems().

Best regards,
  Jesper



Commits

  1. Fixes for single-page hash index vacuum.

  2. Port single-page btree vacuum logic to hash indexes.

  3. Avoid core dump for empty prepared statement in an aborted transaction.

  4. Change representation of statement lists, and add statement location info.