In a relational database model, should an audit table relate to all entities?

2

The title says everything, in a relational database model, an audit table, should it relate to all the entities that I want to insert in the audit?

    
asked by anonymous 02.12.2015 / 23:38

1 answer

2

Even considering this, a question that can lead to many opinions, I will leave my contribution.

My answer is No !

Reasons:

  • Access to writing will be faster, impacting as little as possible in your application since there will be no validation of constraints
  • Being an audit table, you will probably store data that has been deleted (depending on your implementation), this situation alone would make relationships impossible.
  • The retrieval of information in this table will be done in a timely manner in exception situations and not rule.
  • Avoid excessive locks in your application (checking for constraints can cause locks)
  • Any audit implementation that does not use bank constraints can be implemented more easily and quickly, including portability (this will depend on the technology you are using)
  • 03.12.2015 / 00:21