Re: Optimize SELECT * from table WHERE foreign_key_id IN (key1, key2, key3, key4...)

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Niels Kristian Schjødt <nielskristian(at)autouncle(dot)com>, Julien Cigar <jcigar(at)ulb(dot)ac(dot)be>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimize SELECT * from table WHERE foreign_key_id IN (key1, key2, key3, key4...)
Date: 2013-03-06 16:44:00
Message-ID: CAMkU=1zz9Rc=TU5ee+x9BtWD7z1kYsSYJ3Jbp0f4_rTqJN+Cpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Mar 5, 2013 at 4:07 PM, Joshua D. Drake <jd(at)commandprompt(dot)com>wrote:

>
> On 03/05/2013 03:51 PM, Niels Kristian Schjødt wrote:
>
> 3ms isn't slow
>>>
>>> Sorry, it's 3323ms!
>>
>> Can I do anything to optimize that query or maybe the index or something?
>>>>
>>>
>>> your index is already used
>>>
>>
>> Okay this leaves me with - "get better hardware" or?
>>
>
> What does explain analyze say versus just explain.
>

Better yet, "explain (analyze, buffers)" with track_io_timing turned on.

Cheers,

Jeff

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2013-03-06 23:15:08 Re: Poor plan when joining against a union containing a join
Previous Message David Leverton 2013-03-06 14:54:04 Poor plan when joining against a union containing a join