Jump to content

update all fields or only fields that have changed?


perky416

Recommended Posts

Hi Everyone,

 

Im working on a script that edits multiple rows of a database.

Currently when the submit button is clicked, a mysql query updates the table with the new information.

 

It is possible that my website users could have hundreds of rows to edit, so i was wondering will it make much difference speed wise if i let the script continue to update all of the fields in all of the rows, or would it be faster if it only updates fields that have changed?

 

Thanks

I'd say yes... speed and stability will both be affected if you're updating literally hundreds of rows in a single click unless they're all somehow updated with a very limited number of SQL statements without looping in PHP.

 

I've crashed an XAMPP mysql server by running 250 queries in a single click during my earlier days, and necessity being the mother of invention, I was able to bring that down to a still high average of 16.

 

I'm pretty sure that it's the number and complexity  of queries that determines how fast and stable things will be, so if you're accomplishing these updates with a small number of non-looped queries then you'll likely be okay. Otherwise you'll want to rethink.

Hi NUDD,

 

You have said pretty much what i thought, its reassuring to get someone else's input.

 

Iv decided to add check box's to the form that handles the data, now the query only updates rows where the box is checked, and im going to limit each page to a maximum of say 100 rows.

 

Thanks mate

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.