Re: stats are way off on 8.4 b1

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

 



Grzegorz Jaśkiewicz wrote:
Can correlation be negative ?

Yes, if the data in the column are in descending order. For example:

postgres=# CREATE TABLE foo(id int4);
CREATE TABLE
postgres=# INSERT INTO foo SELECT 1000 - generate_series(1, 1000);
INSERT 0 1000
postgres=# ANALYZE foo;
ANALYZE
postgres=# SELECT attname, correlation FROM pg_stats  WHERE tablename='foo';
 attname | correlation
---------+-------------
 id      |          -1
(1 row)

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux