Re: indexes across joins not used for count

From: Jeremy Wells <jemmyw(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: indexes across joins not used for count
Date: 2012-10-21 08:49:12
Message-ID: 5083B708.5090306@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2012-10-21 16:59:16 Re: indexes across joins not used for count
Previous Message Jeff Davis 2012-10-21 06:43:08 Re: indexes across joins not used for count