why do hash index builds use smgrextend() for new splitpoint pages

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: why do hash index builds use smgrextend() for new splitpoint pages
Date: 2022-02-24 23:10:59
Message-ID: CAAKRu_b_A0Z+eRHro1wu+6Nmo_+A-RYh+wi-j85OJwmYeqB-Ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm trying to understand why hash indexes are built primarily in shared
buffers except when allocating a new splitpoint's worth of bucket pages
-- which is done with smgrextend() directly in _hash_alloc_buckets().

Is this just so that the value returned by smgrnblocks() includes the
new splitpoint's worth of bucket pages?

All writes of tuple data to pages in this new splitpoint will go
through shared buffers (via hash_getnewbuf()).

I asked this and got some thoughts from Robert in [1], but I still don't
really get it.

When a new page is needed during the hash index build, why can't
_hash_expandtable() just call ReadBufferExtended() with P_NEW instead of
_hash_getnewbuf()? Does it have to do with the BUCKET_TO_BLKNO mapping?

- Melanie

[1] https://www.postgresql.org/message-id/CA%2BTgmoa%2BQFFhkHgPxyxv6t8aVU0r7GZmu7z8io4vGG7RHPpGzA%40mail.gmail.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message samay sharma 2022-02-24 23:11:32 Re: Proposal: Support custom authentication methods using hooks
Previous Message osumi.takamichi@fujitsu.com 2022-02-24 23:01:57 RE: Failed transaction statistics to measure the logical replication progress