Index
» Projects
» phpMyEdit
» Forum
» Optimized UPDATE Request? |
|
patricek_97
Joined: 21 Nov 2007
Posts: 5
Posted: 2007-11-21 20:09
Back to top
Reply with quote
|
Does phpMyEdit send optimized SQL Update request?
In other words, the UPDATE request only includes the fields that have been modified in the form or all the fields are included?
#1 UPDATE t SET f1=v1, f2=v2, f3=v3 WHERE id=x
#2 UPDATE t SET f3=v3 WHERE id=x
|
michal
Joined: 17 Jun 2003
Posts: 537
Location: Slovakia
Posted: 2007-11-25 16:23
Back to top
Reply with quote
|
there is an extra select query to determine which values are changed (see $changed array available in triggers), so the query should be optimized (imho it is)
|
patricek_97
Joined: 21 Nov 2007
Posts: 5
Posted: 2007-11-25 16:30
Back to top
Reply with quote
|
If a SELECT request is sent before the UPDATE, I can't say it's optimized...
IMHO, phpMyEdit should find the fields that have been edited and build the UPDATE request based on those fields.
|
michal
Joined: 17 Jun 2003
Posts: 537
Location: Slovakia
Posted: 2007-11-25 16:39
Back to top
Reply with quote
|
the problem is how you find which fields are changed. current way is to do extra select query and compare the two. (other way would be to somehow remember it from the previous page). the difference is dealing with situation when two people are editing the row in same time (like: select, select, update, update). currently, the last one takes all.
|
patricek_97
Joined: 21 Nov 2007
Posts: 5
Posted: 2007-11-26 20:17
Back to top
Reply with quote
|
I propose to save the original values (maybe with hidden fields). Only fields that have been changed would be sent to MySQL... My 2c.
BTW, phpMyAdmin does that.
|
Post new topic
Reply to topic
|
|
|
|