Thread: pg_stat_all_indexes

pg_stat_all_indexes

From
"Campbell, Lance"
Date:

PostgreSQL: 8.2.4

 

I did the following query on my database:

 

select * from pg_stat_all_indexes;

 

My hope was to see if my indexes are being used.  The values I got were all 0’s for the columns: idx_scan, idx_tup_read, and idx_tup_fetch.

 

Is there a different query to tell me how often indexes are being used?

 

My postgresql.conf file settings are:

 

#---------------------------------------------------------------------------

# RUNTIME STATISTICS

#---------------------------------------------------------------------------

 

# - Query/Index Statistics Collector -

 

#stats_command_string = on

#update_process_title = on

 

#stats_start_collector = on             # needed for block or row stats

                                        # (change requires restart)

#stats_block_level = off

#stats_row_level = off

#stats_reset_on_server_start = off      # (change requires restart)

 

 

# - Statistics Monitoring -

 

#log_parser_stats = off

#log_planner_stats = off

#log_executor_stats = off

#log_statement_stats = off

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 

Re: pg_stat_all_indexes

From
Tom Lane
Date:
"Campbell, Lance" <lance@uiuc.edu> writes:
> select * from pg_stat_all_indexes;
> My hope was to see if my indexes are being used.  The values I got were
> all 0's for the columns: idx_scan, idx_tup_read, and idx_tup_fetch.

You aren't collecting these stats:

> #stats_block_level = off
> #stats_row_level = off

            regards, tom lane