Re: [ADMIN] since when has pg_stat_user_indexes.idx_scan been counting? - Mailing list pgsql-performance

From Tomas Vondra
Subject Re: [ADMIN] since when has pg_stat_user_indexes.idx_scan been counting?
Date
Msg-id 4DCC4718.8000409@fuzzy.cz
Whole thread Raw
In response to Re: [ADMIN] since when has pg_stat_user_indexes.idx_scan been counting?  (Willy-Bas Loos <willybas@gmail.com>)
Responses Re: [ADMIN] since when has pg_stat_user_indexes.idx_scan been counting?  (Greg Smith <greg@2ndquadrant.com>)
List pgsql-performance
Dne 12.5.2011 22:03, Willy-Bas Loos napsal(a):
> Then, are the index scans counted in a memory variable and written at
> analyze time?

No, I believe raghu mixed two things - stats used by the planner and
stats about access to the data (how many tuples were read using an
index, etc.)

Stats for the planner are stored in pg_class/pg_statistic/pg_stats
catalogs and are updated by ANALYZE (either manual or automatic). This
is what raghu refered to, but these stats are completely useless when
looking for unused indexes.

Stats about access to the data (index/seq scans, cache hit ratio etc.)
are stored in pg_stat_* and pg_statio_* catalogs, and are updated after
running each query. AFAIK it's not a synchronous process, but when a
backend finishes a query, it sends the stats to the postmaster (and
postmaster updates the catalogs).

Tomas

pgsql-performance by date:

Previous
From: raghu ram
Date:
Subject: Re: [ADMIN] since when has pg_stat_user_indexes.idx_scan been counting?
Next
From: Maciek Sakrejda
Date:
Subject: Re: Poor performance when joining against inherited tables