honmaple
V2EX  ›  问与答

sql 触发器该什么时候用?

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

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