honmaple
V2EX  ›  问与答

sql 触发器该什么时候用?

  •  
  •   honmaple · May 21, 2016 · 1877 views
    This topic created in 3642 days ago, the information mentioned may be changed or developed.
    如题,比如我要更新文章的更新时间,我可以直接在保存时更新更新时间,也可以使用触发器更新,两者之间有什么不同吗?性能上有区别吗?
    2 replies    2016-05-21 18:40:29 +08:00
    yangxiongwei
        1
    yangxiongwei  
       May 21, 2016
    ```
    `modification_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
    ```

    类似这样
    murmur
        2
    murmur  
       May 21, 2016
    级联操作。。我们一般都拿来做审计 比如表修改的时候记一条数据。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   975 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 20:35 · PVG 04:35 · LAX 13:35 · JFK 16:35
    ♥ Do have faith in what you're doing.