This project is archived and is in readonly mode.
Eliminate extra queries when using Optimistic Locking with Partial Updates
Reported by Daniel Morrison | June 15th, 2008 @ 09:41 PM | in 2.1.1
If you use optimistic locking with partial updates, you get extra queries where they aren't needed.
Example (save a person without updates):
Person.first
Person.save!
Generates:
Person Update with optimistic locking (0.000400) UPDATE `people`
SET `lock_version` = 14
WHERE id = 339
AND `lock_version` = 13
This patch duplicates the functionality of ActiveRecord::Base#update, where the update isn't run if there are no fields in the update.
Therefore, when you use locking with partial updates, you won't have extra queries floating around.
Comments and changes to this ticket
-
Jeremy Kemper June 16th, 2008 @ 12:27 PM
- Milestone set to 2.1.1
- State changed from new to open
- Assigned user set to Jeremy Kemper
-
Repository June 23rd, 2008 @ 04:37 AM
- State changed from open to resolved
(from [44b890740003d27a4d80a07df33efd57476d37e4]) Partial updates don't update lock_version if nothing changed. [#426 state:resolved]
-
Repository June 23rd, 2008 @ 04:37 AM
(from [3610997ba32128921115bedb89c322a7bcbe161a]) Partial updates don't update lock_version if nothing changed. [#426 state:resolved]
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>