[Ruby] Dumb ActiveRecord question

Ryan Davis ryand-ruby at zenspider.com
Fri Jan 5 17:02:10 PST 2007


On Jan 5, 2007, at 2:06 PM, Alex Vollmer wrote:

> Get yer rotten veggies ready for this one...
>
> I have a bunch of lookup data in a couple of tables that gets  
> referenced
> over and over and over. When I include these lookup tables in a
> has_manyassociation with an
> :include declaration, ActiveRecord creates some LEFT OUTER JOIN SQL  
> that
> performs a sequential table scan.

As pointed out, development mode is trashing your class. There are  
ways around that like putting the data outside the class, of course,  
but I'm wondering how much measuring you've actually done before  
caching this info. Premature optimization and all that...

Also, did you write any tests for this caching behavior?



More information about the Ruby mailing list