Strange performance boost with random()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux