pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ключников А.С. <alexs@analytic.mv.ru>
To: pgsql-performance@postgresql.org
Subject: query from partitions
Date: Tue, 13 Dec 2005 18:18:19 +0300
Message-ID: <20051213151818.GA10021@mail.analytic.mv.ru> (raw)

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



view thread (5+ messages)  latest in thread

Message-ID: <20051213151818.GA10021@mail.analytic.mv.ru>
Permalink:  ../20051213151818.GA10021@mail.analytic.mv.ru/
Also on:    postgresql.org/message-id/20051213151818.GA10021@mail.analytic.mv.ru

 · 

reply

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: alexs@analytic.mv.ru
  Subject: Re: query from partitions
  In-Reply-To: <20051213151818.GA10021@mail.analytic.mv.ru>

* 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