How innodb tables are locked when ON INSERT trigger is processed?
I have two innodb tables: articles id | title | sum_votes ------------------------------ 1 | art 1 | 5 2 | art 2 | 8 3 | art 3 | 35 votes id | article_id | vote ------------------------------ 1 | 1 | 1 2 | 1 | 2 3 | 1 | 2 4 | 2 | 10 5 | 2 | -2 6 | 3 | 10 7 | 3 | 15 8 | 3 | 12 9 | 3 | -2 When a new record is inserted into the votes table, I want to update the sum_votes field in articles table by calculating the sum of all votes. The question Which way is more efficient, if the SUM() calculation itself is a very heavy one ( votes table has 700K records). 1. Creating a trigger CREATE TRIGGER