From: Steinar H. Gunderson <sgunderson@bigfoot.com>
To: Ключников А.С. <alexs@analytic.mv.ru>
Cc: pgsql-performance@postgresql.org
Subject: Re: query from partitions
Date: Tue, 13 Dec 2005 17:08:52 +0100
Message-ID: <20051213160852.GA3740@uio.no> (raw)
In-Reply-To: <20051213151818.GA10021@mail.analytic.mv.ru>
References: <20051213151818.GA10021@mail.analytic.mv.ru>
On Tue, Dec 13, 2005 at 06:18:19PM +0300, Ключников А.С. wrote:
> select * from base
> where id in (select id from device where id = 1 or id = 2) and
> datatime between '2005-05-15' and '2005-05-17';
> 10 minits
That's a really odd way of saying "1 or 2". It probably has to go through all
the records in device, not realizing it can just scan for two of them (using
two index scans). I'd guess an EXPLAIN ANALYZE would confirm something like
this happening (you'd want to run that and post the results here anyhow).
/* Steinar */
--
Homepage: http://www.sesse.net/
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: sgunderson@bigfoot.com, alexs@analytic.mv.ru
Subject: Re: query from partitions
In-Reply-To: <20051213160852.GA3740@uio.no>
* 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