2

I'm working in a legacy codebase/database. The code previously depended on triggers but at one point stopped using them - the logic was moved into the main (Nodejs) codebase and the CREATE TRIGGER statements were removed. Nonetheless, the triggers still exist in the DB. I can see them searching the pg_trigger table: enter image description here

As far as I can tell they're still enabled which is weird because to my knowledge they shouldn't be doing anything. If they're not being used I'd like to remove them. My questions:

  1. Is there way to tell the last time a trigger executed?
  2. Are there any other ways I can figure out if these triggers are even doing anything anymore?

1 Answer 1

2

There is no way to do that, unless you modify the triggers to record the execution somewhere.

Perhaps session_replication_role is set to replica. Then normal triggers (tgenabled = 'O') don't fire.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.