• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we use AJAX in my situation

 
Ram kovis
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WE have a Search and a Search results JSPs

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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ram kovis
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
johny sil
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Thread hi-jack removed.

johny, start your own questions in your own topics]
[ November 19, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic