Is clustering factor stored in pg_stats.correlation?

From: AlexK987 <alex(dot)cue(dot)987(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Is clustering factor stored in pg_stats.correlation?
Date: 2014-12-20 22:59:03
Message-ID: 1419116343364-5831610.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I believe that tables' clustering factors are stored in pg_stats.correlation.
Here is how I came to this conclusion:

create table narrow_table as
with numbers as(
select generate_series as n from generate_series(0,1048575))
select n as seq_number,
(n/1024) + ((n%1024)<<10) as rand_number
from numbers;

alter table narrow_table
add constraint pk_narrow_table primary key(seq_number);

alter table narrow_table
add constraint unq_narrow_table unique(rand_number);

cluster narrow_table using pk_narrow_table;

vacuum full analyze narrow_table;

Now my table is physically ordered by its primary key. Apparently the
following query indicates that:

SELECT attname, correlation
FROM pg_stats
WHERE tablename LIKE '%narrow%';

"seq_number";1
"rand_number";0.00665399

Please correct me if I am wrong, or confirm my conclusion.

--
View this message in context: http://postgresql.nabble.com/Is-clustering-factor-stored-in-pg-stats-correlation-tp5831610.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-12-20 23:28:51 Re: Is clustering factor stored in pg_stats.correlation?
Previous Message AlexK987 2014-12-20 22:50:22 Re: How to connect to postgres.app on Mac from PgAdmin