Hi Tomas!

> On 7 Jun 2024, at 20:41, Tomas Vondra <tomas.von...@enterprisedb.com> wrote:
> 
> After looking into parallel builds for BRIN and GIN indexes, I was
> wondering if there's a way to do parallel builds for GiST too. I knew
> next to nothing about how GiST works, but I gave it a shot and here's
> what I have - the attached patch allows parallel GiST builds for the
> "unsorted" case (i.e. when the opclass does not include sortsupport),
> and does not support buffered builds.

I think this totally makes sense. I've took a look into tuples partitioning 
(for sorted build) in your Github and I see that it's complicated feature. So, 
probably, we can do it later.
I'm trying to review the patch as it is now. Currently I have some questions 
about code.

1. Do I get it right that is_parallel argument for gistGetFakeLSN() is only 
needed for assertion? And this assertion can be ensured just by inspecting 
code. Is it really necessary?
2. gistBuildParallelCallback() updates indtuplesSize, but it seems to be not 
used anywhere. AFAIK it's only needed to buffered build.
3. I think we need a test that reliably triggers parallel and serial builds.

As far as I know, there's a well known trick to build better GiST over PostGIS 
data: randomize input. I think parallel scan is just what is needed, it will 
shuffle tuples enough...

Thanks for working on this!


Best regards, Andrey Borodin.

Reply via email to