Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jC3Ec-0005L4-GV for pgsql-general@arkaria.postgresql.org; Wed, 11 Mar 2020 15:25:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jC3Eb-0003FD-DN for pgsql-general@arkaria.postgresql.org; Wed, 11 Mar 2020 15:25:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jC3Eb-0003Cd-07 for pgsql-general@lists.postgresql.org; Wed, 11 Mar 2020 15:25:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jC3EY-0003jv-Jz for pgsql-general@lists.postgresql.org; Wed, 11 Mar 2020 15:25:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 02BFPKcg006224; Wed, 11 Mar 2020 11:25:20 -0400 From: Tom Lane To: Michael Lewis cc: "pgsql-general@lists.postgresql.org" Subject: Re: Web users as database users? In-reply-to: References: <28CB89D3-194A-420F-868A-0AFC169EF7E5@gmail.com> <16391.1568989132@sss.pgh.pa.us> Comments: In-reply-to Michael Lewis message dated "Wed, 11 Mar 2020 08:46:08 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6222.1583940320.1@sss.pgh.pa.us> Date: Wed, 11 Mar 2020 11:25:20 -0400 Message-ID: <6223.1583940320@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Lewis writes: > On Fri, Sep 20, 2019 at 8:19 AM Tom Lane wrote: >> There is a restriction on how many distinct GRANTs you can >> issue against any one object --- performance will get bad if the ACL >> list gets too large. > Any ballpark numbers here? Are we talking 50 or 8000? More like the former. aclitems are 12 bytes each, so once you get past ~100 items in an object's ACL list, the array is going to get large enough to be subject to toasting, greatly increasing the time to access it. That's not even counting the question of whether scanning lots of items to determine access privileges is expensive. The code that deals with ACL lists isn't terribly well optimized. I'm not aware that anyone's done formal performance testing, but if you want to have a lot of roles in the system, my expectation is that you'd be better off granting privileges to a small number of group roles and then granting group role membership as appropriate. regards, tom lane