when I update 100 records from the table with the trigger enabled it takes 15 seconds to execute, but when I run it without the trigger it takes only 2.
That’s on the local development version, on the production one it takes two minutes. Is there any way I can speed it up?
Thanks.
DROP TRIGGER IF EXISTS imuebles_update;
DELIMITER |
CREATE TRIGGER imuebles_update AFTER UPDATE ON imuebles
FOR EACH ROW
BEGIN
IF NEW.pub_id IS NULL THEN
DELETE FROM search_engine WHERE id = NEW.idImuebles;
ELSE
REPLACE INTO search_engine SELECT * FROM search_engine_v WHERE id = NEW.idImuebles;
END IF;
END;
|
DELIMITER ;
Well to me it looks like,
is potentially a pretty heavy duty thing to run on each row after an update.
My guess is that it would require a good look at why this is required rather than being a simple fix.
If you post some database structure information, perhaps somebody can suggest how to fix it.