On 8/21/07, Stephen Davies <scldad@xxxxxxxxxx> 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) ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster