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 1rnT8N-00DRFg-5h for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 00:51:47 +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 1rnT8L-00HRFM-Ns for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 00:51:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rnT8L-00HRFE-Cm for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 00:51:45 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rnT8I-005ot4-SA for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 00:51:45 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-368650da308so5501715ab.2 for ; Thu, 21 Mar 2024 17:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711068701; x=1711673501; 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=5lbJfEtw8TgWsWwB5Aw0/HSkKdMTVuFnDmsLV3bqEhk=; b=eOmD2LgjPqLdlDUBHgaiX27YdRASTgDJKk08jozRATh7QcSvD4H4q+QJFDRWzVoPM+ 6eY03B8pgLtW3k93AXmkqEwfyVw48lh08EeW6T57lnoMXYVS15PnpSezjS5Uu30cNt8h u5jOyydbegypGSgKvsMVD/erCn62gjb0dg4VoS6JOeEaP0+VDVI+U1fQxMnuGFkq3o8q EThuh+RB5bBzJ9pJin2F5yxgLRobhuJP774LQKu5HCIWzKPGRbTZv8VBSwmWjPWvuV7h OTPV5Ju0s6bQEZe7sFHJLjJUGKqstaVxnbw4f05OqdTq5WCF7RnhHMHZdOIEpJNNCUxV Kibw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711068701; x=1711673501; 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=5lbJfEtw8TgWsWwB5Aw0/HSkKdMTVuFnDmsLV3bqEhk=; b=lgiOWk8NhM4gOQINPLSlB04No87PAHLDpDo/jjcktVJ6BjmVxR7kBn7sXEM8XKumqr GKZE8Aw+42hPPzEIFWYW17aXAX0El1WUO/T621SQMxmJGtMc5rgmx/Z9c0dLor/095j0 I9PGJWDHhRWENfCIyS5qKtsEvP9zfc314F8sSQfIR33pxnra7hwRF46VCKszs2m8MN1u szRc372EPcGQ3eOhd57wr2uIYMn9nc5sKfPbZ4lj7MmZ2ABPLq9mr+JpIMqLHmH2On1o +KBvZwEA0WJbSvpPa1PqdktXzijBrY6TOWj+Rg7JvqdMHiCMGCfQ4ZS7uSpKZCcAO9tv 7S+A== X-Gm-Message-State: AOJu0Yx/hBr+eGgK8q+rTj7EiWbvdVYmpPo5IOEQ0KRHgxbHKJOhGELm mkm4XXT3AWOI5Dkbb8QkOs4iub+SeuhZvxU1rhJ2IftcNlc+nYYW X-Google-Smtp-Source: AGHT+IExOm0Kd2J2k/iNYGD/e7fEVTYYK7rawmaCflwoeaS8DQhZTI2lGb3yu9ETNqoue2n9cNvW0A== X-Received: by 2002:a92:c9cd:0:b0:368:4920:b673 with SMTP id k13-20020a92c9cd000000b003684920b673mr1211670ilq.2.1711068701019; Thu, 21 Mar 2024 17:51:41 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id b61-20020a0295c3000000b0047bef01f008sm230156jai.4.2024.03.21.17.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 17:51:40 -0700 (PDT) Date: Thu, 21 Mar 2024 19:51:39 -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: <20240322005139.GA2060816@nathanxps13> References: <341186.1711037256@sss.pgh.pa.us> <619340.1711050134@sss.pgh.pa.us> <642442.1711053105@sss.pgh.pa.us> <20240321204012.GA1992418@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240321204012.GA1992418@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 21, 2024 at 03:40:12PM -0500, Nathan Bossart wrote: > On Thu, Mar 21, 2024 at 04:31:45PM -0400, Tom Lane wrote: >> I don't think we have any really cheap way to de-duplicate the role >> OIDs, especially seeing that it has to be done on-the-fly within the >> collection loop, and the order of roles_list is at least potentially >> interesting. Not sure how to make further progress without a lot of >> work. > > Assuming these are larger lists, this might benefit from optimizations > involving SIMD intrinsics. I looked into that a while ago [0], but the > effort was abandoned because we didn't have any concrete use-cases at the > time. (I'm looking into some additional optimizations in a separate thread > [1] that would likely apply here, too.) Never mind. With the reproduction script, I'm only seeing a ~2% improvement with my patches. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com