Re: Optimising "in" queries - Mailing list pgsql-performance

From Scott Marlowe
Subject Re: Optimising "in" queries
Date
Msg-id dcc563d10708212120y3d6ee14elbd60dcf92f161730@mail.gmail.com
Whole thread Raw
In response to Optimising "in" queries  (Stephen Davies <scldad@sdc.com.au>)
List pgsql-performance
On 8/21/07, Stephen Davies <scldad@sdc.com.au> wrote:
> I have a PostgreSQL 8.2.4 table with some seven million rows.
>
> The psql query:
>
> select count(rdate),rdate from reading where sensor_id in
> (1137,1138,1139) group by rdate order by rdate desc limit 1;
>
> takes a few seconds but:
>
> select count(rdate),rdate from reading where sensor_id in
> (1137,1138,1139,1140) group by rdate order by rdate desc limit 1;
>
> (anything with four or more values in the "in" list) takes several
> minutes.

Can we see explain analyze output?  (i.e. not just plain explain)

pgsql-performance by date:

Previous
From: Ben Perrault
Date:
Subject: Poor Performance after Upgrade
Next
From: "Steinar H. Gunderson"
Date:
Subject: Re: Poor Performance after Upgrade