> > We have seen some deadlocks and tempfile count in pg_stat_database view. > We are trying to reset the stats. > Can we use pg_stat_reset() function to reset these stats without any > impact stats of databases. > Please advise the process to reset the stats. >
Yes, you could reset stats every month or week or whatever you decide makes sense so you have an understanding of the timeline. Else, knowing that an index has been used X times since who-knows-when is not a very useful piece of information. I have occasionally reset the stats on all indexes on a table when adding or removing an index from that table so that I have an accurate idea of whether index_xyz or index_abc gets used. You can take a snapshot of the stats on the table occasionally and compare prior count to new count if you prefer. I find reset to be cleaner.