Search Postgresql Archives

Re: Correlation in pg_stats

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

 



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@xxxxxxxxx>:

> 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.
> 
> 


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux