We are running Postgres 9.6.23 on Google Cloud SQL, with the Primary Instance being used for the (transactional) application and a Read Replica being used for analytical purposes.
Querying pg_stat_user_indexes
gives a long list of results with 0 scans, but we are not sure how to interpret those stats regarding the replicas with enough confidence to drop some of the indexes as the transactional and analytical queries are very different.
How are the pg_stat_user_indexes
stats replicated?
Statistics views like pg_stat_user_indexes
don't show data persisted in tables, so these data are not replicated. Rather, they show data for the database usage on the standby when you query them on a standby.
To determine if an index is unused or not, query the view on the primary and all standby servers.