Обсуждение: Avoid dynahash's freelist in BufferAlloc.

Поиск
Список
Период
Сортировка

Avoid dynahash's freelist in BufferAlloc.

От
Yura Sokolov
Дата:
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.sokolov@postgrespro.ru
funny.falcon@gmail.com

Вложения