Re: Searching for big differences between values

Поиск
Список
Период
Сортировка
От Chris Mair
Тема Re: Searching for big differences between values
Дата
Msg-id 932d868d47b18e1793b20f3d2f42ab58@smtp.hushmail.com
обсуждение исходный текст
Ответ на Searching for big differences between values  (Durumdara <durumdara@gmail.com>)
Список pgsql-general
> I need to search for big differences between values.
[...]

Hi,

from an SQL point of view this is not difficult, but you need to
carefully define a criteria for the outliers.

For example, to find values that are more than a standard deviation
away from the mean, do something like this:

chris=# select * from val;   x
-------    20    21  21.5    30    28 46392 46393    40
(8 rows)

chris=# select * from val where x > (select avg(x) + stddev(x) from val) or x < (select avg(x) - stddev(x) from val);
x
------- 46392 46393
(2 rows)

Try with n*stddev(x) for n = 2, 3, 4, 5, ... to see
if you can get to your outliers...

Bye,
Chris.



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

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: large numbers of inserts out of memory strategy
Следующее
От: Rory Campbell-Lange
Дата:
Сообщение: Re: Searching for big differences between values