Jeff Davis wrote:
>
> I tried making three tables about the same size as yours, and then doing
> a three-way join, and on my machine it took closer to a second. So
> there's clearly something else going on with your data. Maybe the data
> distribution is skewed (some values having many matches in another
> table, others having none)?
>
Every row in sms_requests will match a row in sms_messages (but maybe
the same row as sms_requests n<-->1 sms_messages). Each row in invites
will have either 0 or 1 row in sms_requests.
Given that the number of sms_messages with sent_at IS NULL will remain
pretty constant will the query continue to run at about the same speed
or will it slow significantly as each table grows in size? Although the
time of the count is slow it's not giving me problems yet. Can I speed
it up? Would it make sense to denormalize the sent_at time into a
boolean on the sms_requests table?
Thanks for your help so far,
Jeremy