Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rnhw1-00Ee7x-KI for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 16:40:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rnhvz-005FgO-Mb for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 16:40:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rnhvz-005FgG-DR for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 16:39:59 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rnhvv-005smC-Mf for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 16:39:58 +0000 Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-7d0377850aaso16535439f.3 for ; Fri, 22 Mar 2024 09:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711125596; x=1711730396; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QVbusf4XBb/4CL0cF34TD/tI6p83i480CPK5/8LhXfw=; b=LAahNFVgiVh9QWFSXj7i7eH4x3t56oNRp1WgpTeV+tLPOB+cOh/afc6719HK+abh5y BlCYrCmtrN71DqagpZqZWf5S6elk0QbgTIaIgF8SVeUqXzZU58VBIrCpsgShXS8mi9jx /KpYVVza0F6n98lHIBJffwI0P2zSPg8HnnSkFaD5NCGkSY9EcnBA2Be2xy3+BNo62rv+ 9bsK4qPWXmwgl8RPKwozDiZ6rxWmewe2JUOVZcaLHIx4Mj0QEUL3LP2uJYYP3Ia2+Knl QFLSe6TUPZNDc1wY3QjeG+Xytbz6lYU8tR7IZ2U/JmNFp/tSMb1vk5wxX3tZioGNOuYO 0OGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711125596; x=1711730396; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QVbusf4XBb/4CL0cF34TD/tI6p83i480CPK5/8LhXfw=; b=SC4I3LGjWkliwld4WQydk35qhhNTe9mZMgVr3yICrGdBUGE8IIHHFJ/fZ8CFFaxAzb b7F1fd8eYDtkU5eN7DA7cxF9ycU8KJttOidqHogUn19rodFhP/WQI5lqWqKZqEq9dChS a36DPFnShxbWwzLuTIP6T5N9ZsDO7sY4ETlrDPbZyTlt4YvWLJAQQsBjAKqWTFRkGP4V Vfxl/2LZNU3sGvKCJc0+zlSDer0w7o7fstB0zDB3AEJ70+0aaJ8E11Acp0569ZIfEmw6 m/FyrAIpu57/IBmlEWRNnUfc8Vj8YYmZyTOO7yb12SYV43wp6hJ3ieQ8VZIKIhJFcrUh NR5A== X-Gm-Message-State: AOJu0YwifscBSxxYM2H8SgYICvqJM7r2zqod+IqNWkDHL5BsSw/EYe+2 /tsHrlDSuemzVRoYWVUTNHBsx1G6LuBNf7KBTza0OlY/pdGIUzRZ X-Google-Smtp-Source: AGHT+IGZuRQzcW2Mz1ibBbwT6XCrcTvWceWjhXHyxsrp+BFeMqT6glyH/6TQ07dhE2TJ+Rxp5qdHYg== X-Received: by 2002:a6b:5c02:0:b0:7cf:3d3:7549 with SMTP id z2-20020a6b5c02000000b007cf03d37549mr3116978ioh.15.1711125595840; Fri, 22 Mar 2024 09:39:55 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id x34-20020a0294a5000000b0047bf7a10f23sm511662jah.170.2024.03.22.09.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:39:55 -0700 (PDT) Date: Fri, 22 Mar 2024 11:39:52 -0500 From: Nathan Bossart To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org, alex work , Robert Haas Subject: Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs Message-ID: <20240322163952.GA2347986@nathanxps13> References: <341186.1711037256@sss.pgh.pa.us> <619340.1711050134@sss.pgh.pa.us> <642442.1711053105@sss.pgh.pa.us> <20240321204012.GA1992418@nathanxps13> <20240322005139.GA2060816@nathanxps13> <806361.1711069194@sss.pgh.pa.us> <20240322144739.GA2321246@nathanxps13> <20240322145532.GA2346110@nathanxps13> <907785.1711121266@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <907785.1711121266@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Mar 22, 2024 at 11:27:46AM -0400, Tom Lane wrote: > Yeah, that's about what I'd expect: hash+bloom ought to remove > most (not quite all) of the opportunity for simd to shine, because > the bloom filter should eliminate most of the list_member_oid calls. Right. IMHO the SIMD work is still worth considering because there are probably even more extreme cases where it'll make a decent amount of difference. Plus, that stuff is pretty low overhead for what you get in return. That being said, the hash table and Bloom filter should definitely be the higher priority. > * Same question for the bloom logic, but here I think it's mostly > a matter of tuning those constants. I suspect there might be some regressions just after the point where we construct the filter, but I'd still expect that to be a reasonable trade-off. We could probably pretty easily construct some benchmarks to understand the impact with a given number of roles. (I'm not sure I'll be able to get to that today.) > * Do we want to risk back-patching any of this, to fix the performance > regression in v16? I think that the OP's situation is a pretty > narrow one, but maybe he's not the only person who managed to dodge > roles_is_member_of's performance issues in most other cases. I've heard complaints about performance with many roles before, so I certainly think this area is worth optimizing. As far as back-patching goes, my current feeling is that the hash table is probably pretty safe and provides the majority of the benefit, but anything fancier should probably be reserved for v17 or v18. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com