pg_replication_slots: how to determine how far behind a consumer is? Given the replication api exposed in postgres 9.6.6, for a given replication slot and a consumer, what system catalogs or view could inform how far behind the consumer was the latest state of the wal?
The view you are looking for is pg_stat_replication.  In 9.6 you can only get this info expressed in LSN, not clock time.  Starting in v10, you can get it in clock time.