• 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

Updating only modified fields

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
Consider a scenario in which a form with several editable elements are shown to the User. This form has a save button. Now the User makes some changes and clicks on the save button. The usual practise is to save all the elements (rather than the changed ones). I have heard that its a better practice to save only the modified changes. But this approach has several difficulties :
1. Need to detect a change and which element has changed.
2. We will have to use dynamic Queries.
3. Since the Queries are dynamic i will have to use Java Statement objects rather than Prepared Statements.
Please give your thoughts on this. Is is always advisable to update only the modified field? Now that my Update Query keeps changing, will that not have a negative impact that i cannot have the Query parsed and the Query plan ready, since each query will be a new one (in most cases).
Please give your thoughts on this. Is it actually worth Updating only modified fields??
Thanks,
Sajee Joseph
 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess it really depends on how much overall data there is.
The thing is really more of a consideration of how much time is saved writing all the data with a prepared query compared to writing some of the data with a dynamic query. If this is going to be a user-oriented process, and done one at a time, then I'd say that you probably won't even notice a performance difference. So it'd be a whole lotta work for marginal (if any) gain.
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic