I’ve been exploring index usage statistics in PostgreSQL and noticed that pg_stat_user_indexes only provides cumulative counters (idx_scan), but not recency information.
Problem: - Counters reset on restart or pg_stat_reset() - No way to determine when an index was last used - Makes it hard to safely identify unused indexes
Proposal: Introduce lightweight tracking of last-used timestamp for indexes.
Could you elaborate the problem trying to solve here? As you mentioned idx_scan already tracks the usage. Periodic snapshots should provide the usage over a period of time. What is the purpose of exact timestamp?