Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y3RU6-0004JR-FL for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2014 15:34:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y3RU5-0000u2-Nt for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2014 15:34:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y3RU4-0000tw-8x for pgsql-hackers@postgresql.org; Tue, 23 Dec 2014 15:34:52 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y3RU0-00052e-TB for pgsql-hackers@postgresql.org; Tue, 23 Dec 2014 15:34:50 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id D0A505FC05; Tue, 23 Dec 2014 10:34:47 -0500 (EST) Date: Tue, 23 Dec 2014 10:34:47 -0500 From: Stephen Frost To: Tom Lane Cc: Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: [COMMITTERS] pgsql: Use a bitmask to represent role attributes Message-ID: <20141223153447.GD3062@tamriel.snowman.net> References: <31247.1419347882@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Eldrgvv4EWsIM1sO" Content-Disposition: inline In-Reply-To: <31247.1419347882@sss.pgh.pa.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-40-generic (x86_64) X-Uptime: 10:21:31 up 3 days, 19:01, 4 users, load average: 0.06, 0.14, 0.15 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: 0.6 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --Eldrgvv4EWsIM1sO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tom Lane (tgl@sss.pgh.pa.us) wrote: > Alvaro Herrera writes: > > Use a bitmask to represent role attributes > > The previous representation using a boolean column for each attribute > > would not scale as well as we want to add further attributes. >=20 > > Extra auxilliary functions are added to go along with this change, to > > make up for the lost convenience of access of the old representation. >=20 > I have to apologize for not having paid more attention, but ... is this > *really* such a great idea? You've just broken any client-side code > that looks directly at pg_authid. Anything which looks at pg_authid for the relevant columns needs to be updated for the changes which were made for rolreplication previously, and now rolbypassrls and any other role attributes added. While I agree that it's something to consider (and even mentioned it earlier in the thread..), there wasn't any argument about it from those who were following the discussion. Perhaps we could have gone out of our way to ask the pgAdmin authors and other client-side utilities which look at these columns if this will more issues than new columns do. > Moreover, I don't particularly buy > the idea that this somehow insulates us from the compatibility costs of > adding new role properties: you're still going to have to add columns to > the pg_roles view, and adjust clients that look at that, every time. That's correct, however, this change wasn't intended to insulate anyone =66rom those compatibility changes but rather to make better use of the bytes in each pg_authid record. We were already up to 8 individual bool columns, wasting space for each. > Replacing bool-column accesses with bitmask manipulation doesn't seem > like it's a win on a micro-optimization level either, certainly not for > SQL-level coding where you've probably made it two orders of magnitude > more expensive. I agree that it's more expensive for SQL users, but it's not our first use of a bitmask in the catalog. Perhaps this is more user-visible than other use-cases but we also provide views to address common usages in this case already, where we don't in other situations. > And lastly, what happens when you run out of bits in > that bigint column? We can add another, though this seems unlikely to happen given the previous discussion and review of what additional role attributes would be nice to add. There are some scenarios I've considered which would lead to using perhaps another 15-20, but 64 sure seems far off. > Again, I suppose I should have objected earlier, but I really seriously > doubt that this is a good idea. I tried to solicit discussion about these concerns earlier but we're all busy, no problem. For my 2c, I do think this is the right direction to go in as adding another 15 boolean columns to pg_authid definitely strikes me as a bad idea, but we can certainly discuss the trade-offs. Another proposal (from Simon, as I recall) was to use an array. That runs into nearly all the same problems and the on-disk representation ends up being even larger, which is why I didn't see that being a good idea. Thanks, Stephen --Eldrgvv4EWsIM1sO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUmYuXAAoJEO1sijiDR2RVKWEP/28oqdlURsJ6PykxkXDosc1S OuRdnrNpNP7iZxtpsR5H+F22kNRyZfVMKxzc+Vet/1DlaZNoJlZbFMQ3BX+D3N9P RgEPe5gPVITG3bX0F/poSLNaJJ4qcbKThLx8lIwC+6q6aJMPkY/lnzv+oyOb0itJ GIRl8qEZi69LaERlmbxgntEGauqLiLJ2bqXpMXE/SKIIW5WPPFcNNUvbXK6+Shzj J5Nt6IUmXWmJCwD7rZ3FbrHvj9RfImWyEtCZ+VygS1UUKSy6F2RHD1h1QJJYIcOI gqGbqDTUjEDqCSliq9HerjShjf+nxK1YHmsv5wCT5AuSo2GwqRFtCwhpNO1BvsVc w8BWoaEEqTFL0/R1r7uhUhGWoXOrfZQmni2CpsDM0kCzQwbB1LhDbvO7NoGeV0ae 5U0++yXWEikVvxCUT9geJffMM1TQc6L7D9L4LLJ1Hsos5MmuU87UHHj0jWtptHF7 XIB82rznzjBwoAEV0XCHjLv0pIOK8pmaL4UQqg0ROB9LqVNXiTowhKde34ZgYyTF 7oZWtLA5uR53ihi7rfVToOt7oeYKF9ULbEPHWueyf0IKRf6oQ85DC+8QsIkANcXb LuVYWGwUFNaSMfNE2DhXEbjr0yiUhReQRW/GJL+gdGCUBThjuLMAhr4jXZzIVDTG GC1mWrqSXpYxkevAsWlN =ohpj -----END PGP SIGNATURE----- --Eldrgvv4EWsIM1sO--