Re: random() (was Re: New GUC to sample log queries)

Adrien NAYRAT <adrien.nayrat@anayrat.info>

From: Adrien NAYRAT <adrien.nayrat@anayrat.info>
To: Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>, Dmitry Dolgov <9erthalion6@gmail.com>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, <vik.fearing@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, "Michael Paquier" <michael@paquier.xyz>, David Rowley <david.rowley@2ndquadrant.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-12-28T12:10:38Z
Lists: pgsql-hackers
On 12/26/18 7:45 PM, Tom Lane wrote:
> I wonder whether we should establish a project policy to avoid use
> of random() for internal purposes, ie try to get to a point where
> drandom() is the only caller in the backend.

FYI I picked the idea from auto_explain. Maybe we will have to change 
auto_explain too.


Commits

  1. Use pg_strong_random() to select each server process's random seed.

  2. Use a separate random seed for SQL random()/setseed() functions.

  3. Marginal performance hacking in erand48.c.

  4. Fix latent problem with pg_jrand48().

  5. Silence compiler warning

  6. Add log_statement_sample_rate parameter