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)化的余地?
千萬里不及你
2019-04-08 09:21:38