A count makes the database do a lot more work as it must count all
matching rows not just find the first one that matches. Depending
on the exact conditions used and the database schema/indices/size the
difference can be very large.

On R, 2007-12-21 at 14:13 -0500, Rick Olson wrote:
> > Well I ended up with that code by taking apart find :first and
> > removing the instantiation of rows at the end, so I don't think it
> > should be a problem.
> > What I posted should be doing exactly what find :first does, but
> > without the instantiation
> 
> Why not just use count?
> 
> count(:id, :conditions =>...) > 0
> 
> 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to