PostgreSQL equivalent of Oplog Tailing in MongoDB

In PostgreSQL 9.4 and newer you can use the test_decoding plugin via pg_recvlogical to stream changes from a replication slot.

In 9.3 and newer pg_xlogdump can decode the transaction log segments, but that means you have to capture and dump each segment, and it really requires WAL archiving to be enabled in order to be practical.

You should also look at:

  • The pg_stat_statements extension
  • The built-in pg_stat_activity view
  • The built-in pg_stat_.. views like pg_stat_user_indexes, etc.