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.89) (envelope-from ) id 1gcGcz-0003VE-1W for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Dec 2018 21:22:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gcGcx-0006Si-En for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Dec 2018 21:22:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gcGcx-0006Sb-7Y for pgsql-hackers@lists.postgresql.org; Wed, 26 Dec 2018 21:22:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gcGcu-0002y1-Pe for pgsql-hackers@postgresql.org; Wed, 26 Dec 2018 21:22:06 +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 wBQLLk3A021087; Wed, 26 Dec 2018 16:21:47 -0500 From: Tom Lane To: Peter Geoghegan cc: Alvaro Herrera , Adrien Nayrat , Thomas Munro , Dmitry Dolgov <9erthalion6@gmail.com>, Tomas Vondra , Vik Fearing , Robert Haas , Michael Paquier , David Rowley , Pg Hackers Subject: Re: random() (was Re: New GUC to sample log queries) In-reply-to: References: <20181129214850.kiq6mvofsgplqjdr@alvherre.pgsql> <3859.1545849900@sss.pgh.pa.us> <5659.1545852666@sss.pgh.pa.us> <14047.1545855555@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Wed, 26 Dec 2018 12:27:50 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21085.1545859306.1@sss.pgh.pa.us> Date: Wed, 26 Dec 2018 16:21:46 -0500 Message-ID: <21086.1545859306@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > On Wed, Dec 26, 2018 at 12:19 PM Tom Lane wrote: >> Replacing random() might actually make that easier not harder, since >> we'd have more control over what happens when. > That does seem useful. I'm in favor. But why does the function to seed > the internal PRNG have to be loadable? Can't it just be > superuser-only? That'd work as far as I'm concerned. (But I can hear Frost wanting a built-in role for it ;-)) One thing we'd have to think about if we want to take this seriously is whether a process-wide PRNG state is really adequate; if you're trying to make a particular call site be deterministic, you'd likely wish it weren't interfered with by other call sites. On the flip side, having more call sites probably makes things more random and thus better for normal usage. Not sure how to resolve that tension (but I don't want to build a whole lot of new infrastructure here). regards, tom lane