| From: | Tim Uckun <timuckun(at)gmail(dot)com> |
|---|---|
| To: | Chris <dmagick(at)gmail(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Query not using the indexes properly. |
| Date: | 2009-10-02 02:19:57 |
| Message-ID: | 855e4dcf0910011919v69b8251fif9932b6c6f66716@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
> It probably thinks the id check is going to be better to limit the result
> set.
>
> How many records are there for id > 1935759 ?
About 40 million or so.
> vs
> How many records for company_id = 4 and source_model_name =
> 'CommissionedVisit' ?
>
> If this is a common query you could probably do a multi-column index on all
> 3 columns (id, company_id, source_model_name) - but if company_id and
> source_model_name have a low number of distinct values, then it's not going
> to help.
Both of those will indeed have a pretty low number of distinct values.
Looks like I need to figure out something else.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tim Uckun | 2009-10-02 02:21:35 | Re: Query not using the indexes properly. |
| Previous Message | David Wilson | 2009-10-02 02:18:56 | Re: Query not using the indexes properly. |