Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, alex work <alexwork033@gmail.com>, Robert Haas <robertmhaas@gmail.com>
Date: 2024-03-22T01:03:32Z
Lists: pgsql-hackers, pgsql-general
On Thu, Mar 21, 2024 at 08:59:54PM -0400, Tom Lane wrote:
> However ... I just remembered that we have a Bloom filter implementation
> in core now (src/backend/lib/bloomfilter.c).  How about using that
> to quickly reject (hopefully) most role OIDs, and only do the
> list_member_oid check if the filter passes?

Seems worth a try.  I've been looking for an excuse to use that...

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



Commits

  1. Optimize roles_is_member_of() with a Bloom filter.

  2. Use a hash table for catcache.c's CatCList objects.