Strange performance boost with random()

Поиск
Список
Период
Сортировка
От M Putz
Тема Strange performance boost with random()
Дата
Msg-id alpine.DEB.2.02.1402102007580.14849@skaj
обсуждение исходный текст
Ответы Re: Strange performance boost with random()  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-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



В списке pgsql-performance по дате отправления:

Предыдущее
От: Sergey Konoplev
Дата:
Сообщение: Re: Bloated tables and why is vacuum full the only option
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Strange performance boost with random()