0

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 insert, delete and updates.

Would really appreciate any help!

1
  • 1
    explain analyze will tell you the number of rows per table the query touched.
    – mustaccio
    Aug 24 at 18:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.