Consult real-time database inserts

Asked

Viewed 193 times

2

There is a table in Mysql that suffers many insertions.
The application needs to show these changes to the customer.
Currently the existing application query, every 10 seconds, the table and shows on the screen its contents.
Is there any way that the bank itself informs when there are changes in the table? Or is there a way to improve this type of scenario?

The problem is the infinite loop that jquery gets, sending every 10 seconds a post to capture the information in the database.

1 answer

1

I also have this problem, so during some researches I found a feature called Triggers(Trigger) in the MySql.

My idea is to create another table with a Trigger that records the change (tabela_update), where it has its field (update type int) changed whenever there are any UPDATE, DELETE or INSERT.
So bring the information only when this int field is different and not always send the $.post.

I know you have much better techniques but I’m leaving only one option ;).

  • Thought Long Polling ?

  • I’m giving a study, I’ve never seen.

  • And Websocket, you’ve read about it?

  • I just found this too, but where I work is used classic Apple :( to thinking it doesn’t work.

  • I read an answer here in the stack where it is mentioned that Long Polling is a good idea, however it can still generate a resource overload pq goes against its purpose of creation. It is then mentioned that Websocket is the real solution... https://answall.com/questions/254506/o-que%C3%A9-long-Polling

Browser other questions tagged

You are not signed in. Login or sign up in order to post.