I have a database that has both sequenced correlated to table unique ids and "standalone" but having values.

I need to know which ones are really used but I'm not the owner of every procedure running on the database.

Is there any way to know when a Postgres sequence was last used?


No, the time when a sequence is used is not recorded by PostgreSQL.

I would figure out the last_value of each sequence, wait for a week and do it again. Then you can easily see which sequences have advanced and how much.

| improve this answer | |
  • Thank you, I think I'll do so. Actually before asking I've looked all the db catalog without finding a timestamp, so just asking to see if I lost something but no way – Andrea Giovacchini Apr 3 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.