From: | Omar Kilani <omar(dot)kilani(at)gmail(dot)com> |
---|---|
To: | Xia Qingran <qingran(dot)xia(at)gmail(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Bad performance of SELECT ... where id IN (...) |
Date: | 2009-10-05 01:58:52 |
Message-ID: | f0cc3e3e0910041858w1ed5ca21t24ccf98c8b2396a7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi Xia,
Try this patch:
http://treehou.se/~omar/postgresql-8.4.1-array_sel_hack.patch
It's a hack, but it works for us. I think you're probably spending
most of your query time planning, and this patch helps speed things up
10x over here.
Regards,
Omar
On Sun, Sep 27, 2009 at 5:13 PM, Xia Qingran <qingran(dot)xia(at)gmail(dot)com> wrote:
> On Sat, Sep 26, 2009 at 10:59 PM, Craig James
> <craig_james(at)emolecules(dot)com> wrote:
>>
>> If your user_id is always in a narrow range like this, or even in any range
>> that is a small fraction of the total, then add a range condition, like
>> this:
>>
>> select * from event where user_id <= 500 and user_id >= 0 and user_id in
>> (...)
>>
>> I did this exact same thing in my application and it worked well.
>>
>> Craig
>>
>
> It is a good idea. But In my application, most of the queries' user_id
> are random and difficult to range.
> Thanks anyway.
>
>
>
> --
> 夏清然
> Xia Qingran
> qingran(dot)xia(at)gmail(dot)com
> Sent from Beijing, 11, China
> Charles de Gaulle - "The better I get to know men, the more I find
> myself loving dogs." -
> http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Mielke | 2009-10-05 02:22:18 | Maybe OT, not sure Re: Best suiting OS |
Previous Message | Scott Marlowe | 2009-10-05 00:42:50 | Re: Best suiting OS |