Skip site navigation (1) Skip section navigation (2)

Re: stats are way off on 8.4 b1

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: stats are way off on 8.4 b1
Date: 2009-04-18 06:59:27
Message-ID: 49E97A4F.9090408@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-performance
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

In response to

Responses

pgsql-performance by date

Next:From: Grzegorz JaśkiewiczDate: 2009-04-18 12:02:08
Subject: Re: stats are way off on 8.4 b1
Previous:From: Grzegorz JaśkiewiczDate: 2009-04-17 23:34:23
Subject: Re: stats are way off on 8.4 b1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group