From: Scott Marlowe <scott.marlowe@gmail.com>
To: Stephen Davies <scldad@sdc.com.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimising "in" queries
Date: Tue, 21 Aug 2007 23:20:25 -0500
Message-ID: <dcc563d10708212120y3d6ee14elbd60dcf92f161730@mail.gmail.com> (raw)
In-Reply-To: <200708221210.36770.scldad@sdc.com.au>
References: <200708221210.36770.scldad@sdc.com.au>
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: scott.marlowe@gmail.com, scldad@sdc.com.au
Subject: Re: Optimising "in" queries
In-Reply-To: <dcc563d10708212120y3d6ee14elbd60dcf92f161730@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox