I have table A that supports the number of users in table B. All I need is that the account in table A is synchronized with the number of users in table B.
So, whenever I insert a user into table B, I want the account to increase / decrease depending on the user insert or delete.
There are two ways: a) If I insert a row into table B, I can specify the number of updates in table A in one stored procedure. This result consists of two plugin commands followed by an update. Therefore, let's say take 2 seconds. (assuming each txn in 1 second)
b) I can write the insert command in a stored procedure. Also, define a trigger that updates the account in table A after the insert is completed in table A. For me, it only takes 1 second, which simply inserts a row into table B. I assume that “after the insert trigger” that updates the account in table B, occurs in the background and, therefore, is asynchronous or asynchronous, locking.
Whether this presumption is correct or whether both approaches will take equal time.
Note. I do not care about the update counting time in table A. Therefore, I am looking for a method that performs synchronization in non-blocking mode, as in a queue!
ANY suggestions / comments?