Re: BUG #19340: Wrong result from CORR() function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #19340: Wrong result from CORR() function
Дата
Msg-id 2107637.1765001376@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #19340: Wrong result from CORR() function  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #19340: Wrong result from CORR() function
Список pgsql-bugs
I wrote:
> Dean Rasheed <dean.a.rasheed@gmail.com> writes:
>> Looking at float8_regr_accum(), I think it would be preferable to
>> arrange for it to leave Sxx, Syy, and Sxy zero until distinct X and Y
>> values are seen. I.e., something like this:

> That seems like a good idea.  I was initially worried that the extra
> isnan() checks would slow down aggregation noticeably in the normal
> case where we soon discover that the inputs aren't all equal.

BTW, re-reading the patch, I now think we should drop the initial

    if (isnan(commonX) || isnan(commonY))

test, instead bulling ahead with computing tmpX/tmpY/scale, and
only skip the updates of Sxx/Syy/Sxy when we have constant inputs.
Using that initial test is optimizing for constant inputs at the
expense of non-constant inputs, which seems like the wrong way
to bet.

            regards, tom lane



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