mysql中这个触发器有什么问题?
下面是我需要创建的触发器,但它没有被创建。请任何朋友可以解释一下这个触发器有什么问题吗?请帮助我。
DELIMITER $$
CREATE TRIGGER property_history_update
AFTER UPDATE ON `properties`
FOR EACH ROW BEGIN
IF OLD.ListPrice != NEW.ListPrice THEN
INSERT INTO `property_history`
SET ListingKey = OLD.ListingKey,
ListPrice = NEW.ListPrice,
ListingStatus = OLD.ListingStatus,
LastUpdatedTime = NEW.LocalLastModifiedOn;
END IF;
END$$
DELIMITER ;
当我执行上面的触发器时,出现如下错误:
致命错误:第 99 行 /var/www/phpmyadmin/libraries/import/sql.php 中的最大执行时间超过 300 秒
Below is trigger that I need to create but It is not getting created.Please any buddy can explain me what is wrong with this trigger ? Help me please.
DELIMITER $
CREATE TRIGGER property_history_update
AFTER UPDATE ON `properties`
FOR EACH ROW BEGIN
IF OLD.ListPrice != NEW.ListPrice THEN
INSERT INTO `property_history`
SET ListingKey = OLD.ListingKey,
ListPrice = NEW.ListPrice,
ListingStatus = OLD.ListingStatus,
LastUpdatedTime = NEW.LocalLastModifiedOn;
END IF;
END$
DELIMITER ;
When I executed above trigger I got error as below :
Fatal error: Maximum execution time of 300 seconds exceeded in /var/www/phpmyadmin/libraries/import/sql.php on line 99
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过不带 WHERE 子句的 UPDATE 传递属性中的所有行将具有线性(O(n) [n 是行数的因子])运行时间。如果所有行的 ListPrice 都发生变化,则该时间可能会加倍。
示例:如果您运行“UPDATE properties SET ListPrice = 5;”并且表中有 10,000 行,请放心,property_history 表中将有 10,000 个 UPDATE 和最多 10,000 个 INSERT。
请确保三 (3) 件事:
Passing through all rows in the properties via an UPDATE without a WHERE clause will have a linear (O(n) [n is factor of the number of rows]) running time. That time can double if all rows experience a change in ListPrice.
Example: If you ran "UPDATE properties SET ListPrice = 5;" and there are 10,000 rows in the table, rest assured there will be 10,000 UPDATEs and upto 10,000 INSERTs into the property_history table.
Please make sure you of three(3) things: