X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E1AA39DC85A for ; Tue, 13 Dec 2005 12:08:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95581-02 for ; Tue, 13 Dec 2005 12:08:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 1DD3D9DC85D for ; Tue, 13 Dec 2005 12:08:55 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EmChw-0005t8-Vl; Tue, 13 Dec 2005 17:08:53 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EmChw-00011u-00; Tue, 13 Dec 2005 17:08:52 +0100 Date: Tue, 13 Dec 2005 17:08:52 +0100 From: "Steinar H. Gunderson" To: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= Cc: pgsql-performance@postgresql.org Subject: Re: query from partitions Message-ID: <20051213160852.GA3740@uio.no> Mail-Followup-To: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= , pgsql-performance@postgresql.org References: <20051213151818.GA10021@mail.analytic.mv.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20051213151818.GA10021@mail.analytic.mv.ru> X-Operating-System: Linux 2.6.14 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/315 X-Sequence-Number: 16136 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/