Update Strategy

  • This is more of an application development question.  What are people's approaches on update strategies. 

    If an application has retrieved all of the columns in a row, and a user has changed some columns, should the update procedure issue an update statement for all of the columns or only the columns that have changed.

    Pro's of updating all columns - update can be implemented by way of a store procedure.

    Pro's of updating only changed - unnecessary changes not made (but since number of fields being updated is variable cannot use SP)

    Cheers

     

     

     

  • I would go down the route of updating all columns. I don't think the overhead will be that great (unless it's a very wide table with only a few columns being updated - and even then...). Updating all probably makeds the code simple and therefore more robust.

    The other consideration is concurrency/locking.

    Allen

  • I do understand the problem,

    suppose if 100 columns are there in a table and your application makes changes to only one or two columns, you will be updating all columns .

    But as per me this is the better approach creating stored procedure and doing the same. rather constructing a new update query from the front end and submitting to the database, compile the query, add an entry to syscacheobject and execute the query. Simply stored procedure is better.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply