Re: BitmapHeapScan streaming read user and prelim refactoring

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BitmapHeapScan streaming read user and prelim refactoring
Date: 2025-02-24 16:18:01
Message-ID: CAAKRu_bcJ8ecRM==0+QH_4+by+gtkqxU1U=eZ_q1mGMA+WwHpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 21, 2025 at 5:00 PM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> I thought about doing this, but in the end I decided against this
> approach. If we wanted to make it easy to palloc arrays of different
> sizes and have tbm_extract_page_tuple extract that many tuples into
> the array, we'd have to change more of the code anyway because
> tbm_extract_page_tuple is what tells us how many tuples there are to
> begin with. We could save this somewhere while filling in the
> PagetableEntries initially, but that is a bigger change.
>
> And, passing a length would also mean more callers would have to know
> about TBM_MAX_TUPLES_PER_PAGE, which I think is already kind of a hack
> since it is defined as MaxHeapTuplesPerPage.

I changed my mind. I think since the struct I added was only used for
tbm_extract_page_tuple(), it was a bit weird. I also think it is okay
for callers to use TBM_MAX_TUPLES_PER_PAGE. I ended up revising this
to use the same API you implemented for TIDStore in
TidStoreGetBlockOffsets(). The caller passes an array and the size of
the array and tbm_extract_page_tuple() fills in that many offsets and
returns the total number of offsets. It avoids adding a new struct and
means callers could pass a different value than
TBM_MAX_TUPLES_PER_PAGE. Overall, I like it.

- Melanie

Attachment Content-Type Size
v33-0003-Separate-TBM-Shared-Private-Iterator-and-TBMIter.patch text/x-patch 19.5 KB
v33-0004-BitmapHeapScan-uses-the-read-stream-API.patch text/x-patch 29.1 KB
v33-0001-Add-lossy-indicator-to-TBMIterateResult.patch text/x-patch 6.0 KB
v33-0002-Delay-extraction-of-TIDBitmap-per-page-offsets.patch text/x-patch 15.5 KB
v33-0005-Remove-table-AM-callback-scan_bitmap_next_block.patch text/x-patch 23.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-02-24 16:20:53 Re: explain analyze rows=%.0f
Previous Message Jeff Davis 2025-02-24 16:15:25 Re: Statistics Import and Export