Jeff Cole <cole.jeff@gmail.com> writes:
> Hi Tom, you are correct, the distribution is uneven... In the 13k
> symptom_reports rows, there are 105 distinct symptom_ids. But the
> first 8k symptom_reports rows only have 10 distinct symptom_ids.
> Could this cause the problem and would there be anything I could do
> to address it?
Ah-hah, yeah, that explains it. Is it worth your time to deliberately
randomize the order of the rows in symptom_reports? It wasn't clear
whether this query is actually something you need to optimize. You
might have other queries that benefit from the rows being in nonrandom
order, so I'm not entirely sure that this is a good thing to do ...
regards, tom lane