Re: [WIP] [B-Tree] Retail IndexTuple deletion

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [WIP] [B-Tree] Retail IndexTuple deletion
Date: 2018-08-15 09:28:43
Message-ID: 247f4455-1ca4-b246-4ebf-283fca14ce03@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

15.08.2018 12:17, Masahiko Sawada пишет:
> On Tue, Aug 7, 2018 at 4:19 PM, Andrey Lepikhov
> <a(dot)lepikhov(at)postgrespro(dot)ru> wrote:
>> Hi,
>> I wrote a background worker (hcleaner) to demonstrate application of Retail
>> IndexTuple deletion (see patch at attachment).
>
> The patch doesn't seem to have the hcleaner code. Could you share it?

I appreciate you pointing out my mistake.

Attachment contains full patch set: indexTuple retail deletion, ordering
b-tree tuples by tid (provided by Peter Geoghean) and background cleaner.

In this version of background worker you can show state of the hcleaner
at the 'pg_stat_progress_cleaner' view, like VACUUM.

unlike the previous version, hcleaner check presence a block in memory
before cleanup (see RBM_NORMAL_NO_READ mode at ReadBufferExtended()
call) and do not read blocks from a disk storage (only on shutdown after
SIGTERM signal catch).

For feature demonstration you can use simple test (autovacuum = off):
pgbench -i -s 1 && psql -c $"CREATE INDEX pgbench_accounts_ext ON
public.pgbench_accounts USING btree (abalance);" && pgbench -t <n> -c 20
-j 8 -f test.pgb

where test.pgb is:
-------
\set aid random(1, 100000 * :scale)
\set delta random(-5000, 5000)
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
-------

My workstation shows:

| master | patched |
n |HEAP size | INDEX size | HEAP size | INDEX size |
---------------|-------------------------------------|
2e3 | 13 MB | 2.3 MB | 13 MB | 2.3 MB |
2e4 | 14 MB | 2.7 MB | 13 MB | 2.7 MB |
2e5 | 14 MB | 8.0 MB | 14 MB | 4.8 MB |
2e6 | 61 MB | 58. MB | 14 MB | 6.7 MB |

where HEAP size - size of 'pgbench_accounts' relation; INDEX size - size
of 'pgbench_accounts_ext' index relation.
It is demonstrates a relation 'blowing' problem and influence of
hcleaner in an excessive manner.

Some problem is regression tests modification, because hcleaner makes
physical order of tuples in relations unpredictable.

>
> Regards,
>
> --
> Masahiko Sawada
> NIPPON TELEGRAPH AND TELEPHONE CORPORATION
> NTT Open Source Software Center
>

--
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
0001-Retail-IndexTuple-Deletion-Access-Method.patch text/x-patch 12.0 KB
0002-Quick-Vacuum-Strategy.patch text/x-patch 12.3 KB
0003-Make-all-nbtree-index-tuples-have-unique-keys.patch text/x-patch 104.1 KB
0004-Retail-IndexTuple-Deletion-with-TID-sorting-in-Leaf.patch text/x-patch 6.7 KB
0005-Background-Worker.patch text/x-patch 113.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Arthur Zakirov 2018-08-15 10:20:35 Re: [HACKERS] Bug in to_timestamp().
Previous Message Fabien COELHO 2018-08-15 08:50:48 Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors