Thread: : Column Performance in a query

: Column Performance in a query

From
Venkat Balaji
Date:
Hello Everyone,

Generally when it comes to query performance, I check how the vacuuming and statistics collection is performed on Tables and Indexes hit by the query.

Apart from the above i check the code logic ( for any bad joins ) and column statistics as well.

I got hold of two catalog tables "pg_stats" and "pg_class".

Column "avg_width" and "distinct" in pg_stats gets me lot of sensible information regarding, column values and size of the column.

Can someone help me know when the values in these columns are bound to change ? Is it only when ANALYZE runs ?

I am about to calculate lot of metrics depending on above values. Please help !

Thanks
Venkat


Re: : Column Performance in a query

From
Ondrej Ivanič
Date:
Hi,

On 4 October 2011 21:25, Venkat Balaji <venkat.balaji@verse.in> wrote:
> I got hold of two catalog tables "pg_stats" and "pg_class".
> Column "avg_width" and "distinct" in pg_stats gets me lot of sensible
> information regarding, column values and size of the column.
> Can someone help me know when the values in these columns are bound to
> change ? Is it only when ANALYZE runs ?

yes, ANALYZE updates underlaying pg_statistic table.

--
Ondrej Ivanic
(ondrej.ivanic@gmail.com)