• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can we use AJAX in my situation

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 354
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic