From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, alex work <alexwork033@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Subject: Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs
Date: Tue, 26 Mar 2024 15:08:00 -0400
Message-ID: <3088176.1711480080@sss.pgh.pa.us> (raw)
In-Reply-To: <20240326184819.GA3559028@nathanxps13>
References: <20240322163952.GA2347986@nathanxps13>
<939945.1711126395@sss.pgh.pa.us>
<20240322165448.GA2350322@nathanxps13>
<20240322193506.GA2352051@nathanxps13>
<1084642.1711140109@sss.pgh.pa.us>
<20240325144743.GA2618709@nathanxps13>
<2490242.1711379319@sss.pgh.pa.us>
<20240325151647.GA2662364@nathanxps13>
<20240326165918.GA3350222@nathanxps13>
<2999167.1711476963@sss.pgh.pa.us>
<20240326184819.GA3559028@nathanxps13>
Nathan Bossart <nathandbossart@gmail.com> writes:
> On Tue, Mar 26, 2024 at 02:16:03PM -0400, Tom Lane wrote:
>> ... I'm not sold on your "ROLES_LIST_BLOOM_THRESHOLD * 10"
>> value. Maybe it doesn't matter though.
> Yeah, I wasn't sure how much to worry about this. I figured that we might
> as well set it to a reasonable estimate based on the description of the
> parameter. This description claims that the filter should work well if
> this is off by a factor of 5 or more, and 50x the threshold sounded like it
> ought to be good enough for anyone, so that's how I landed on 10x. But as
> you point out, this value will be disregarded altogether, and it will
> continue to be ignored unless the filter implementation changes, which
> seems unlikely. If you have a different value in mind that you would
> rather use, I'm fine with changing it.
No, I have no better idea. As you say, we should try to provide some
semi-reasonable number in case bloom_create ever starts paying
attention, and this one seems fine.
>> I do not like, even a little bit, your use of a static variable to
>> hold the bloom filter pointer.
> Ah, yes, that's no good. I fixed this in the new version.
My one remaining suggestion is that this comment isn't very precise
about what's happening:
* If there is a previously-created Bloom filter, use it to determine
* whether the role is missing from the list. Otherwise, do an ordinary
* linear search through the existing role list.
Maybe more like
* If there is a previously-created Bloom filter, use it to try to
* determine whether the role is missing from the list. If it
* says yes, that's a hard fact and we can go ahead and add the
* role. If it says no, that's only probabilistic and we'd better
* search the list. Without a filter, we must always do an ordinary
* linear search through the existing list.
LGTM other than that nit.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, alexwork033@gmail.com, robertmhaas@gmail.com
Subject: Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs
In-Reply-To: <3088176.1711480080@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox