> http://gist.github.com/468116 > > Unless there's some logical flaw in my benchmark code, it looks like > prepared statements run about 50% faster overall for these types of > queries.
There's a logical flaw in your benchmark code. The situation is a little more nuanced http://www.mysqlperformanceblog.com/2006/08/02/mysql-prepared-statements/ And for postgresql it can actually be significantly worse when using prepared statements: http://wiki.postgresql.org/wiki/FAQ#Why_is_my_query_much_slower_when_run_as_a_prepared_query.3F However having said that, it's definitely something that could be investigated as a feature in arel, then something we used with auto generated methods like find_by_code_and_status. This has come up a bunch of times but it never really got dragged over the line because the benefits are marginal for a lot of use cases so people lose the motivation to do the hard & fiddly work of finishing up. -- Cheers Koz -- 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 rubyonrails-c...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.