This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Upon entering Seardh criteria in Searh page, Stored procedure is called and the results are diaplyed in Search results page, which has around 30 columns in the HTML table.
Now we have column called Total $ in Search results page. To get data for this column, the stored proc has to query lots of tables and has a huge processing for calculating the total, which is hitting the perforamnce . So, we want to split the stored proc and the process of the page. i.e, First get data all 29 columns and display all the 29 columns in the results page and then we have to call another stored proc and get the the data for the total column. Can we use AJAX here? Can we add a new column dynamically .
Any suggestions sample code will be greatly apprecaited Thanks R
Originally posted by Bear Bibeault: Sure, you could use Ajax for that. But I'm not sure why you would think that making two requests would give you better performance than making one.
Thanks Bear.. Since the stored proc takes a lot of time for the calulation of total column for each row,and eventually for the display the page with all the results, we want to split the processing. First diaply all 29 columns to user and then do the background processing for Total column and then display it as well in the results page.
Won't your users find it odd that the total suddenly appears out of nowhere after they've already been looking at the page for some time?
Irrespective of that, you're also setting yourself up for a race condition. What if, during the time you retrieve the columns and the time that the second request is initiated, something changes in the DB such that the total doesn't reflect the columns sent to the user? Such things are usually best done in a single transaction context.
In fact we have done exactly the same in our system, but it was only for showing the count of results. I think you should use some kind of summary tables to get the best performance. [ November 17, 2006: Message edited by: Abhinav Srivastava ]