I have an application that requires the total number of interactions.
I have two tables. TABLE1 has a total column. TABLE2 has all of the interactions (columns) that update frequently. It has a column like didInteract. It is a 1:M relationship between TABLE1 and TABLE2.
Because my application uses the total interactions from TABLE2 if didInteract is true. I added the column total to TABLE1 so I wouldn't have to query all rows that match my criteria which could be costly. Therefore if a user interacts it performs two operations in the database. First, it creates a new interaction in TABLE2 if not already created and it increments the total interaction in TABLE1.
Does this logic make sense to do, or should I query TABLE2 to get the total (even if it may take a little longer) and remove the total column from TABLE1? Not sure if this passes 2NF although to me it sounds like an exception.