From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | James Hunter <james(dot)hunter(dot)pg(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, 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-04-17 14:56:44 |
Message-ID: | CA+TgmoZRHmcGkyxM5cpqkYt89Mn335y3f7kC=fdpdB50pEtN3Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Apr 16, 2025 at 12:31 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> More or less, yeah, just put the whole ReadStream object in shared
> memory, pin an LWLock on it and call it a parallel-aware or shared
> ReadStream. But how do you make the locking not terrible?
>
> My "work stealing" brain dump was imagining a way to achieve the same
> net effect, except NOT have to acquire an exclusive lock for every
> buffer you pull out of the stream. I was speculating that we could
> achieve zero locking for most of the stream without any cache line
> ping pong, but a cunning read barrier scheme could detect when you've
> been flipped into a slower coordination mode by another backend and
> need to turn on some locking and fight over the last handful of
> buffers. And I was also observing that if you can figure out to make
> it general and reusable enough, we have more unsolved problems like
> this in unrelated parallel query code not even involving streams.
> It's a tiny more approachable subset of the old "data buffered in
> other workers" problem, as I think you called it once.
Maybe the work stealing stuff can hide inside the ReadStream? e.g. a
ParallelReadStream is really one ReadStream per participant, each with
a separate lock. Mostly you only touch your own, but if necessary you
can poke your fingers into other people's ReadStreams.
--
Robert Haas
EDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-04-17 15:20:33 | Re: jsonapi: scary new warnings with LTO enabled |
Previous Message | Tom Lane | 2025-04-17 14:56:25 | Re: disabled SSL log_like tests |