[Solved] Is there a way to realtime detect if there’s new record in database?


Don’t worry about the performance of polling. With a suitable INDEX, MySQL can handle 100 polls/second — regardless of dataset size.

Let’s see SHOW CREATE TABLE and the tentative SELECT to perform the “poll”; I may have further tips.

Also, let’s see the admin’s query that needs to ‘trigger’ the workers into action. Surely the admin can do something simple to cause that. Doing a checksum of a table is terribly heavyweight.

You should consider the admin action to be encoded in a Stored Procedure, thereby separating the polling mechanism from the admin action.

JavaScript can use AJAX to do an INSERT (or call a Stored proc).

This mantra may apply: “Don’t queue it, just do it.” That is, the admin/javascript action can call an application program (PHP/Java/VB/whatever) to actually do the action, no need for queuing. (Please provide more details so we can discuss whether this might be the real solution.)

solved Is there a way to realtime detect if there’s new record in database?