开发者

How to send request from client side if one table affects

I am inserting a row in one table say appcapacity using stored procedure at every 1 min using timer task in java. I am monitoring that table in admin side as chart with two column values say (TIME,FILESIZE) as x and y respectively. ie. in client side by using Google visualization API.

table : appcapacity

TIME                    FILESIZE

19:25:28             1.91015625 KB  
19:39:10             4.400390625 KB 

.                         .
.                         .
.                         .

What i have to do is i need to update that chart with new value i开发者_如何学编程n admin panel if a row gets insert in that table. My question is :

Is that possible to send request from client side to get the data from that table only when a new row gets insert in that table????


Simply reload the chart once every minute (using simple JavaScript).

You could also go for a comet approach to push new values to the client(s). But that seems to be a bit of overhead - especially as long as you use polling on the server side anyway.


You could run a

  SELECT MAX(TIME) FROM table

and compare the result to the last time you ran it. Only fetch all the table data when the result changes.

For this to work, you will need an index on your TIME column so the query above will run really fast.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜