Query planning

Started by Jayadevan Mover 11 years ago2 messagesgeneral
Jump to latest
#1Jayadevan M
maymala.jayadevan@gmail.com

Hi all,

I am going through PostgreSQL documentation on how row estimation is done
in PostgreSQL.
http://www.postgresql.org/docs/current/static/row-estimation-examples.html
There is a reference to cardinality (rel_cardinality) there. But that is an
estimate of the number of rows in the table, right?

How many unique values are there in a column (cardinality), that is
estimated while finding out selectivity?

Regards,
Jayadevan

#2Emanuel Calvo
emanuel.calvo@2ndquadrant.com
In reply to: Jayadevan M (#1)
Re: Query planning

El 31/10/14 a las 04:46, Jayadevan M escibió:

Hi all,

I am going through PostgreSQL documentation on how row estimation is
done in PostgreSQL.
http://www.postgresql.org/docs/current/static/row-estimation-examples.html
There is a reference to cardinality (rel_cardinality) there. But that
is an estimate of the number of rows in the table, right?

How many unique values are there in a column (cardinality), that is
estimated while finding out selectivity?

Did you look into pg_stats view? There is a column colled n_distinct
that indicates
that (-1 all distinct, 1 none distintct). That's what you are asking about?

--
--
Emanuel Calvo http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

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