Re: Correlation in pg_stats

Поиск
Список
Период
Сортировка
От Christian Hammers
Тема Re: Correlation in pg_stats
Дата
Msg-id 20121126214426.72b9f86e@james.intern
обсуждение исходный текст
Ответ на Correlation in pg_stats  (classical_89 <luongnx512@gmail.com>)
Ответы Re: Correlation in pg_stats  (classical_89 <luongnx512@gmail.com>)
Список pgsql-general
Hello

Do you want to search for tables with many unordered rows?

  SELECT
    schemaname, tablename, correlation
  FROM
    pg_stats
  WHERE
    abs(correlation) < 0.2 and
    schemaname not in ('pg_catalog', 'information_schema')
  ;

Or do you want to put the table in order?

  BEGIN;
  CREATE TABLE tbl_test_new (LIKE tbl_test INCLUDING ALL);
  INSERT INTO tbl_test_new SELECT * FROM tbl_test ORDER BY id;
  DROP TABLE tbl_test;
  TABLE tbl_test_new RENAME TO tbl_test;
  COMMIT;

If you really want to get a correlation of near 0 try

  INSERT INTO tbl_test (name) SELECT random() FROM generate_series(1, 100);

bye,

-christian-

Am Mon, 26 Nov 2012 01:52:21 -0800 (PST)
schrieb classical_89 <luongnx512@gmail.com>:

> Hi,First sorry for my bad English :D.I'm new in PostgreSQL and
> database .Now i'm researching about statistic correlation .I want to
> make a example with the table -assume that I have tbl_test table and
> two column - id & name - and do something to get correlation of a
> column is near 0 (zero).What step can i do  ?
> Thanks for your support :)
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Correlation-in-pg-stats-tp5733524.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>


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

Предыдущее
От: Peter Kroon
Дата:
Сообщение: Re: Npgsql
Следующее
От: "Francisco Figueiredo Jr."
Дата:
Сообщение: Re: Npgsql