Watching a table for change in MySQL?

后端 未结 6 1212
不思量自难忘°
不思量自难忘° 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条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 19:04

    It is possible to trigger behaviour outside the database, if you have control of the host.

    A) This question's answer suggests writing to a file using 'select into outfile' with some system process watch that file for changes (e.g. inotify-based approach such as node-inotify or even a Grunt-watch might suffice)

    B) For the brave: The answer to this question points out that if you can install C/C++ add-ons to your database server, you could use a User Defined Function (UDF) to call sys_exec() and thus trigger external processes, or presumably write the actual process directly in the UDF.

    http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html#qandaitem-B-5-1-11

    (I'm researching this at the moment, for an AWS RDS hosted application so unfortunately neither of these options are right for me.)

提交回复
热议问题