From: | Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Avoid dynahash's freelist in BufferAlloc. |
Date: | 2021-09-22 10:52:43 |
Message-ID: | 4f7766222a461703dc4f2ccf333189f1afecbe7a.camel@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Good day.
I found BufferAlloc unnecessary goes through dynahash's freelist when it
reuses valid buffer.
If it is avoided and dynahash's entry directly moved, 1-2% is gained in
select only pgbench (with scale factor 100 in 50 connections/50 threads
on 4 core 8ht notebook cpu 185krps=>190krps).
I've changed speculative call to BufferInsert to BufferLookup to avoid
insertion too early. (It also saves call to BufferDelete if conflicting
entry is already in). Then if buffer is valid and no conflicting entry
in a dynahash I'm moving old dynahash entry directly and without check
(since we already did the check).
If old buffer were invalid, new entry is unavoidably fetched from
freelist and inserted (also without check). But in steady state (if
there is no dropped/truncated tables/indices/databases) it is rare case.
Regards,
Sokolov Yura @ Postgres Professional
y(dot)sokolov(at)postgrespro(dot)ru
funny(dot)falcon(at)gmail(dot)com
Attachment | Content-Type | Size |
---|---|---|
0001-More-gentle-dynahash-usage-in-buffer-alloc.patch | text/x-patch | 10.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2021-09-22 11:15:48 | Re: POC: Cleaning up orphaned files using undo logs |
Previous Message | Yugo NAGATA | 2021-09-22 10:17:12 | Re: Implementing Incremental View Maintenance |