monitoring mysql for changes

后端 未结 5 547
陌清茗
陌清茗 2021-01-18 20:16

I have a Java app using a MySQL database through hibernate. The database is really used as persistence layer: The database is read at the initial load of the program, and

5条回答
  •  我在风中等你
    2021-01-18 20:42

    One option would be tail the binary logs (or setup a replication slave) and look for changes relevant to your application. This is likely to be a quite involved solution.

    Another would be to add a "last_updated" indexed column to the relevant tables (you can even have mysql update this automatically) and poll for changes since the last time you checked. The queries should be very cheap.

提交回复
热议问题