I am using to trigger on a table, after insert and delete, for counting items.
but i think it make query some inefficient.
a transaction inserting 250,000 rows, If trigger is on then it takes 75 seconds. but If trigger isn't then it takes 60 seconds.
when ever i saw some session variable turning off unique check... like that, Is there any way to turn off trigger?
I think MariaDB doesn't optimize trigger by anyway. ( I means it just repeat +1 operation 250,000.. not just +250,000)
below is my trigger.
CREATE TRIGGER incrementTableA
AFTER INSERT ON TableA
FOR EACH ROW
UPDATE Counts
SET Counts.value = Counts.value + 1
WHERE Counts.var='totalTableA';
CREATE TRIGGER decrementTotalTableA
AFTER DELETE ON TableA
FOR EACH ROW
UPDATE Counts
SET Counts.value = Counts.value - 1
WHERE Counts.var='totalTableA';