Re: [WIP] [B-Tree] Retail IndexTuple deletion - Mailing list pgsql-hackers

From Andrey Lepikhov
Subject Re: [WIP] [B-Tree] Retail IndexTuple deletion
Date
Msg-id 247f4455-1ca4-b246-4ebf-283fca14ce03@postgrespro.ru
Whole thread Raw
In response to Re: [WIP] [B-Tree] Retail IndexTuple deletion  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
15.08.2018 12:17, Masahiko Sawada пишет:
> On Tue, Aug 7, 2018 at 4:19 PM, Andrey Lepikhov
> <a.lepikhov@postgrespro.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

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Next
From: Arthur Zakirov
Date:
Subject: Re: [HACKERS] Bug in to_timestamp().