Clear empty space in a page. - Mailing list pgsql-hackers

From Yura Sokolov
Subject Clear empty space in a page.
Date
Msg-id 10c4c221489ea252149569a8431b13f8@postgrespro.ru
Whole thread Raw
Responses Re: Clear empty space in a page.
Re: Clear empty space in a page.
List pgsql-hackers
Good day.

Long time ago I've been played with proprietary "compressed storage"
patch on heavily updated table, and found empty pages (ie cleaned by
vacuum) are not compressed enough.

When table is stress-updated, page for new row versions are allocated
in round-robin kind, therefore some 1GB segments contains almost
no live tuples. Vacuum removes dead tuples, but segments remains large
after compression (>400MB) as if they are still full.

After some investigation I found it is because PageRepairFragmentation,
PageIndex*Delete* don't clear space that just became empty therefore it
still contains garbage data. Clearing it with memset greatly increase
compression ratio: some compressed relation segments become 30-60MB just
after vacuum remove tuples in them.

While this result is not directly applied to stock PostgreSQL, I believe
page compression is important for full_page_writes with wal_compression
enabled. And probably when PostgreSQL is used on filesystem with
compression enabled (ZFS?).

Therefore I propose clearing page's empty space with zero in
PageRepairFragmentation, PageIndexMultiDelete, PageIndexTupleDelete and
PageIndexTupleDeleteNoCompact.

Sorry, didn't measure impact on raw performance yet.

regards,
Yura Sokolov aka funny_falcon
Attachment

pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: security_definer_search_path GUC
Next
From: Thomas Munro
Date:
Subject: O_DIRECT on macOS