I'm working on a tool for postgres and trying to find a way to see what rows a given query scans or touches. Ideally, I'd like to get back a list of tables and the primary keys of the tables that the query scanned or touched. Worst case, at least just the number of rows per table the query touched. I tried
pg_audit but that didn't give me number of rows touched. Also tried triggers but postgres explicitly states that triggers can't be invoked from
select statements, only
Would really appreciate any help!