In accordance with the comments on the question, it turns out that calling a countchain with fromand includes(with the condition for the association included) is a problem.
, from, from("jobs"), , .
includes ( ). , , joins includes ( !). ( , ):
q = Job.from("jobs FORCE INDEX(index1,index2)")
q = q.joins(:workflow)
q = q.where("workflows.name = 'Bob'")
q.count
, includes, :
q = Job.from("jobs FORCE INDEX(index1,index2)")
q = q.joins("left outer join workflows on workflows.job_id = jobs.id")
q = q.where("workflows.name = 'Bob'")
q.count