Reputation: 2037
My application takes in input parameters from UI and executes a set of SQL queries that would return data for the jquery datatables. Each row in the datatables requires processing of multiple sql queries based on the input parameters. So when the input parameters are fed in to retrieve rows more than 1000, you could imagine the processing time it would take. So i am just wondering if we could program it in such a way that as and when a row is processed, could it be returned to the UI while the middle layer continues to work on processing other rows? I'm using JQuery, Ajax to send the input parameters to a servlet which calls the java class to process these rows and sends back the JSON array of data. Any input would be greatly appreciated.
Upvotes: 0
Views: 2205
Reputation: 310884
Rule one of database programming is to do everything possible at the server, rather than shipping data to the application to be processed there and shipped back. Try to express your entire application as a set of SQL statements only.
Upvotes: 0
Reputation: 22710
You can use DataTables server side processing option.
...and if you are working with seriously large databases, you might want to consider using the server-side options that DataTables provides. Basically all of the paging, filtering, sorting etc that DataTables does can be handed off to a server (or any other data source - Google Gears or Adobe Air for example!) and DataTables is just an events and display module.
It will fetch only few records and will display it to the user, rest of the records are only fetched when required like when user clicks on next/previous,
Upvotes: 1