From: M Putz <puma@c007.de>
To: pgsql-performance@postgresql.org
Subject: Strange performance boost with random()
Date: Mon, 10 Feb 2014 20:52:51 +0100 (CET)
Message-ID: <alpine.DEB.2.02.1402102007580.14849@skaj> (raw)
In-Reply-To: <E1WCttM-0006Np-Nj@malur.postgresql.org>
References: <E1WCttM-0006Np-Nj@malur.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Hello,
While analyzing performance, we encountered the following phenomenon,
SELECT sum(pow(.5*generate_series,.5))
FROM generate_series(1,1000000);
is much much (a hundred times) slower than
SELECT sum(pow(random()*generate_series,.5))
FROM generate_series(1,1000000);
and asymptotic difference is even more astounding.
This seems counter-intuitive, considering the cost of
an additional random() call instead of a constant factor.
What are the reasons for this strange performance boost?
Thanks, M. Putz
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: puma@c007.de
Subject: Re: Strange performance boost with random()
In-Reply-To: <alpine.DEB.2.02.1402102007580.14849@skaj>
* 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