Hi all.
Which is more efficient in order to use SELECT FOR UPDATE?
%> SELECT * FROM `table` WHERE (`table_id` = 32) LIMIT 1 FOR UPDATE;
%> UPDATE `table` SET `field_name` = 'Pizza' WHERE (`table_id` = 32)
LIMIT 1;
OR
%> SELECT `field_name` FROM `table` WHERE (`table_id` = 32) LIMIT 1
FOR UPDATE;
%> UPDATE `table` SET `field_name` = 'Pizza' WHERE (`table_id` = 32)
LIMIT 1;
Note: the 2nd query in each is the same. Is there any difference in
using * and specifying the actual field you want to update? It seems
like there would be very little difference because this is causing a
row-lock - all the data in that row is not-updatable anyway.
I'm adding transactions and row-locking into my application. If I can
just use the first method (because it's easier to specify '*' instead
of every column I want to update), then I'd like to. Any thoughts are
welcome!
Thanks in advance,
~Philip
"Personally, most of my web applications do not have to factor 13.7
billion years of space drift in to the calculations, so PHP's rand
function has been great for me..." ~S. Johnson
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php