Write visibility map during CLUSTER/VACUUM FULL

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Write visibility map during CLUSTER/VACUUM FULL
Date: 2019-09-01 08:07:31
Message-ID: CAPpHfdtcxUVys6r6JqX2s+5CowXDKMOnfcJoJWHyjWDe=hwHMw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

I found it weird that CLUSTER/VACUUM FULL don't write visibility map.
Attached patch implements writing visibility map in
heapam_relation_copy_for_cluster().

I've studied previous attempt to implement this [1]. The main problem
of that attempt was usage of existing heap_page_is_all_visible() and
visibilitymap_set() functions. These functions works through buffer
manager, while heap rewriting is made bypass buffer manager.

In my patch visibility map pages are handled in the same way as heap
pages are. RewriteStateData holds contents of single VM page. Once
heap page is finished, corresponding bits are set to VM page etc. VM
pages are flushed one-by-one to smgr.

This patch have to implement its own check if tuple is allvisible.
But it appears to be possible to simplify this check assuming that all
tuples already past HeapTupleSatisfiesVacuum(), which sets hint bits.

Links
1. https://www.postgresql.org/message-id/flat/20131203162556.GC27105%40momjian.us#90e4a6e77d92076650dcf1d96b32ba38

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
0001-write-vm-during-cluster-1.patch application/octet-stream 8.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pierre Ducroquet 2019-09-01 09:04:36 [Patch] Add a reset_computed_values function in pg_stat_statements
Previous Message Alexey Zagarin 2019-09-01 05:25:41 Re: row filtering for logical replication