| From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
|---|---|
| To: | Jann Röder <roederja(at)ethz(dot)ch> |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: Inefficient query plan |
| Date: | 2010-08-23 10:18:02 |
| Message-ID: | AANLkTi=9kbbKV0E0Jao6e7jBAZ1SB=QWKVxzotC_ZQ9R@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On Mon, Aug 23, 2010 at 4:15 AM, Jann Röder <roederja(at)ethz(dot)ch> wrote:
> Am 23.08.10 07:52, schrieb Scott Marlowe:
>> Also are a.indexid and b.indexid the same type?
>>
>
> You mean ItemID? Fields of the same name are of the same type - so yes.
> According to the documentation pgsql adds indexes for primary keys
> automatically so (b.itemID, b.indexNumber) is indexed. Or do you think
> adding an extra idnex for b.itemID alone will help? If I understand the
> documentation correctly, pqSQL can use the first column of a
> multi-column index as if it was indexed individually... but maybe I'm
> wrong here.
It can but that doesn't mean it will. A multi-column index is often
quite a bit bigger than a single column one.
What happens if you try
set enable_seqscan=off;
(your query here)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jann Röder | 2010-08-23 10:20:02 | Re: Inefficient query plan |
| Previous Message | Jann Röder | 2010-08-23 10:15:43 | Re: Inefficient query plan |