Search code examples
sqldatabasebackenddata-capture

how can i know if a table of a database have a new registre?


My goal is to be able to know in real time or close to real time if a new record has been entered in a database or not.

Is it possible to do this or is the only way to poll the table every X seconds to see if anything has changed?

Would polling a table too often to see if a table insert has occurred be bad practice?


Solution

  • I think you can try to use triggers

    In mysql for example

    https://dev.mysql.com/doc/refman/8.0/en/trigger-syntax.html