Re: Using random() in update produces same random value for all - Mailing list pgsql-general

From Tom Lane
Subject Re: Using random() in update produces same random value for all
Date
Msg-id 15531.1516641381@sss.pgh.pa.us
Whole thread Raw
In response to Re: Using random() in update produces same random value for all  (Olleg Samoylov <splarv@ya.ru>)
Responses Re: Using random() in update produces same random value for all  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
Olleg Samoylov <splarv@ya.ru> writes:
> Looked like random() is "volatile", but in subselect it works like "stable".

The point here is that that's an uncorrelated subselect --- ie, it
contains no outer references --- so it need not be, and is not,
re-evaluated at every outer row.

            regards, tom lane


pgsql-general by date:

Previous
From: Olleg Samoylov
Date:
Subject: Re: Using random() in update produces same random value for all
Next
From: Rakesh Kumar
Date:
Subject: Re: Slow alter sequence with PG10.1