From: | Ключников А(dot)С(dot) <alexs(at)analytic(dot)mv(dot)ru> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | query from partitions |
Date: | 2005-12-13 15:18:19 |
Message-ID: | 20051213151818.GA10021@mail.analytic.mv.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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(at)analytic(dot)mv(dot)ru
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-12-13 15:59:11 | Re: query from partitions |
Previous Message | Tom Lane | 2005-12-13 15:13:12 | Re: Memory Leakage Problem |