On 3 April 2012 22:30, Fearless Fool wrote:
> Let me redact that previous post...my only excuse is that I hadn't had
> my coffee yet!
>
> If the time to make a DB query (let's call it 1 Unit of time) swamps out
> any amount of processing in Ruby, then:
>
> Approach A (do a SELECT to check for exis
Let me redact that previous post...my only excuse is that I hadn't had
my coffee yet!
If the time to make a DB query (let's call it 1 Unit of time) swamps out
any amount of processing in Ruby, then:
Approach A (do a SELECT to check for existence of the record before
attempting an insert) will tak
Joe V. wrote in post #1053641:
> A SQL query takes around 1 ms, possibly more if the db server is on a
> different machine. That is way more expensive than rescuing an
> exception.
Joe: Thanks for the useful data point. Just to make sure my
understanding is complete, since any db transaction is
Fearless Fool wrote in post #1053062:
> Peter Vandenabeele wrote in post #1052874:
>> A custom validation on the compound unique key would behave
>> similar, always do a SELECT (and suffer from the race condition
>> documented in
>>
>
http://api.rubyonrails.org/classes/ActiveRecord/Validations/Clas
Peter Vandenabeele wrote in post #1052874:
> A custom validation on the compound unique key would behave
> similar, always do a SELECT (and suffer from the race condition
> documented in
>
http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of
5 matches
Mail list logo