From: Tom Lane <tgl@sss.pgh.pa.us>
To: Olleg Samoylov <splarv@ya.ru>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Using random() in update produces same random value for all
Date: Mon, 22 Jan 2018 12:16:21 -0500
Message-ID: <15531.1516641381@sss.pgh.pa.us> (raw)
In-Reply-To: <471561516635427@web43o.yandex.ru>
References: <CA+cR4zde6SSaMfznJRgrM1zB2NYHjh6Uzn1ARXYW9_4sRvvUPA@mail.gmail.com>
<CAD3a31Wkji3HCPxcRDdA6P6xHjjURV-YP_Z6wYitqSpc2G0e4g@mail.gmail.com>
<471561516635427@web43o.yandex.ru>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, splarv@ya.ru
Subject: Re: Using random() in update produces same random value for all
In-Reply-To: <15531.1516641381@sss.pgh.pa.us>
References: <CA+cR4zde6SSaMfznJRgrM1zB2NYHjh6Uzn1ARXYW9_4sRvvUPA@mail.gmail.com> <CAD3a31Wkji3HCPxcRDdA6P6xHjjURV-YP_Z6wYitqSpc2G0e4g@mail.gmail.com> <471561516635427@web43o.yandex.ru> <15531.1516641381@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox