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 603A99DC80C for ; Tue, 13 Dec 2005 11:18:28 -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 79675-06 for ; Tue, 13 Dec 2005 11:18:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 5F4A99DC817 for ; Tue, 13 Dec 2005 11:18:22 -0400 (AST) Received: from analytic.mv.ru (analytic.mv.ru [213.242.11.222]) by svr2.postgresql.org (Postfix) with ESMTP id 67EF9F0B4F for ; Tue, 13 Dec 2005 15:18:26 +0000 (GMT) Received: by analytic.mv.ru (Postfix, from userid 2002) id A2E8020DB; Tue, 13 Dec 2005 18:18:19 +0300 (MSK) Date: Tue, 13 Dec 2005 18:18:19 +0300 From: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= To: pgsql-performance@postgresql.org Subject: query from partitions Message-ID: <20051213151818.GA10021@mail.analytic.mv.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i 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/313 X-Sequence-Number: 16134 Hi. create table device(id int); insert into device values(1); insert into device values(2); ..... insert into device values(250); create table base ( id int, data float, datatime timestamp, mode int, status int); create table base_1 ( check ( id = 1 and datatime >= DATE '2005-01-01' and datatime < DATE '2006-01-01' ) ) INHERITS (base); create table base_2 ( check ( id = 2 and datatime >= DATE '2005-01-01' and datatime < DATE '2006-01-01' ) ) INHERITS (base); .... create table base_250 And select * from base where id in (1,2) and datatime between '2005-05-15' and '2005-05-17'; 10 seconds 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 Why? -- mailto: alexs@analytic.mv.ru