Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Transactional sync of live data with ajax

Author  Topic 

gllen
Starting Member

7 Posts

Posted - 2010-04-28 : 19:29:21
I have a webpage with an ajax call that downloads a large set of data every minute.

In the query/list it downloads, a very small percentage of the rows have actually changed since the last update.

So to allow this to scale I'd like to send only updates of changes to the table (insert/delete/update) instead of the full table every time.

I'm looking for something easy to implement for more than one format. Optimally I'd like to be able to make changes to a simple relational database on both ends that can handle all types of transactions.

I'm using SQL Server 2005 and I'm open to pretty much any server-side and javascript languages that will make implementing this easy.



TIA

lazerath
Constraint Violating Yak Guru

343 Posts

Posted - 2010-05-07 : 14:42:55
I'd keep a datetime column indicating when each record was last modified. When a client connects, it retrieves all rows and updates an internal variable indicating the time. When the AJAX triggers a refresh, pass along the internal variable and return only the records changed since last time. If you delete data out of the table, you will have to store the deleted data for client updates, perhaps in a separate table or even in the same table with a Row Status attribute. In either case, you will need to regularly purge the deleted data that is 'stale'.
Go to Top of Page
   

- Advertisement -