Re: Bad performance of SELECT ... where id IN (...) - Mailing list pgsql-performance

From Tom Lane
Subject Re: Bad performance of SELECT ... where id IN (...)
Date
Msg-id 22763.1253984637@sss.pgh.pa.us
Whole thread Raw
In response to Bad performance of SELECT ... where id IN (...)  (Xia Qingran <qingran.xia@gmail.com>)
Responses Re: Bad performance of SELECT ... where id IN (...)
List pgsql-performance
Xia Qingran <qingran.xia@gmail.com> writes:
> I have a big performance problem in my SQL select query:
> select * from event where user_id in
> (500,499,498, ... ,1,0);
> The above SELECT always spends 1200ms.

Your EXPLAIN ANALYZE shows that the actual runtime is only about 240ms.
So either the planning time is about 1000ms, or transmitting and
displaying the 134K rows produced by the query takes that long, or some
combination of the two.  I wouldn't be too surprised if it's the data
display that's slow; but if it's the planning time that you're unhappy
about, updating to a more recent PG release might possibly help.  What
version is this anyway?

            regards, tom lane

pgsql-performance by date:

Previous
From: Gerhard Wiesinger
Date:
Subject: Re: PG 8.3 and large shared buffer settings
Next
From: Pierre Frédéric Caillaud
Date:
Subject: Re: PG 8.3 and large shared buffer settings