Post.includes(:user).where('sticky=trueORidin(selectpost_idfrom`feeds`whereuser_id=?)',current_user.id).page(params[:page]).per(15)意即SELECTCOUNT(*)FROM`posts`WHERE`posts`.`trashed`=0AND(sticky=trueORidin(selectpost_idfrom`feeds`whereuser_id=1))
這條mysql查詢是否還有優(yōu)化的余地?
繁星coding
2019-04-16 17:06:02