Re: random() (was Re: New GUC to sample log queries) - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: random() (was Re: New GUC to sample log queries)
Date
Msg-id CAH2-Wz=MGrJ5G-FtKVDnWzVuj6P2imQ3QTydex2fDgQGHXfdew@mail.gmail.com
Whole thread Raw
In response to Re: random() (was Re: New GUC to sample log queries)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: random() (was Re: New GUC to sample log queries)  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On Wed, Dec 26, 2018 at 11:31 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
 > I've used setseed() to make nbtree's "getting tired" behavior
> > deterministic for specific test cases I've developed -- the random()
> > choice of whether to split a page full of duplicates, or continue
> > right in search of free space becomes predictable.

> TBH, I'd call it a bug --- maybe even a low-grade security hazard
> --- that it's possible to affect that from user level.

I don't disagree with that conclusion. Deterministic behavior is
always preferable to random behavior when the randomness is not truly
necessary.

> There might well be debugging value in affecting internal PRNG usages,
> but let's please not think it's a good idea that that's trivially
> reachable from SQL.

I hesitate to say that there is much value beyond the value that I've
found in this one instance. Maybe the remaining cases where this
technique could be applied just aren't very interesting.

-- 
Peter Geoghegan


pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Next
From: Peter Geoghegan
Date:
Subject: Re: random() (was Re: New GUC to sample log queries)