Ruby on rails 3 Rails中活动记录查询中查找器方法的顺序

Ruby on rails 3 Rails中活动记录查询中查找器方法的顺序,ruby-on-rails-3,activerecord,Ruby On Rails 3,Activerecord,我正在编写一个复杂的活动记录查询来从多个表中获取数据,该查询包含join、select、order、group和select where @posts = Post.published.paginate(:order => 'popularity desc, id', :joins => [:comments, :images, :updates, :user],

我正在编写一个复杂的活动记录查询来从多个表中获取数据,该查询包含join、select、order、group和select where

         @posts = Post.published.paginate(:order => 'popularity desc, id',
                                          :joins => [:comments, :images, :updates, :user],
                                          :conditions => conditions,
                                          :group => "posts.id",
                                          :select => "posts.id*,
                                          :per_page => 10, 
                                          :page => params[:page]) 
我想知道根据标准,where、join等的顺序应该是什么,并最大限度地提高查询的性能。如果有人能写一个查询来解释序列,那将非常棒,就像

@posts = Post.published.joins(:comments, :images, :updates, :user).where(....

据我所知,顺序无关紧要

例如:

@posts = Post.published.select('posts.id').
  joins(:comments, :images, :updates, :user).
  where('users.email = ?', 'john@doe.com').
  group('posts.id')