Domanda

We are trying to debug some of the problems we are having on our production database server. One thing we would like to enable is pg_stat_statements, but we are holding off on restarting the service. In the meantime, we had the idea that we could enable pg_stat_statements and restart the hot standby. The thinking here was that we could at least see all of the writes that were issued in production, just on a time delay. However, this doesn't seem to be the case.

Is there a way to view the updates that are issued by the WAL logs on the hot standby?

EDIT: or by streaming replication?

È stato utile?

Soluzione

pg_stat_statements has nothing to do with WAL. The WAL doesn't record statements and you cannot discover what statements were run from WAL. It only records blocks changed on disk and relevant related metadata.

It's definitely not useful on a standby.

You could use pg_xlogdump (pg_waldump on pg10 and newer) to view the low level WAL stream, but without a lot of experience and time you won't be able to understand it. It doesn't and can't show table names and row info, only table relfilenodes and tuple TIDs, plus binary tuple data.

If you want to avoid installing pg_stat_statements you could make a poor-man's version by capturing pg_stat_activity on a timer and doing your own parsing and merging.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange
scroll top