Watching a table for change in MySQL?

后端 未结 6 1205
不思量自难忘°
不思量自难忘° 2020-12-05 18:23

Is there a better way to watch for new entries in a table besides selecting from it every n ticks of time or something like that?

I have a table that an external pro

6条回答
  •  Happy的楠姐
    2020-12-05 19:03

    Another similar approach would be to add

    add column Last_Modified TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP 
    

    to each table and preface your select queries to compare the last request date/time with the max(Last_Modified).

    Databases are typically pull sources and not push so you'll still need to programmatically probe for changes no matter what.

提交回复
热议问题