Re: Automating Partitions in PostgreSQL - Query on syntax
От | Kedar Potdar |
---|---|
Тема | Re: Automating Partitions in PostgreSQL - Query on syntax |
Дата | |
Msg-id | bd8134a40904210703n11daeab7qfb8b9be4771854ee@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Automating Partitions in PostgreSQL - Query on syntax ("Dickson S. Guedes" <listas@guedesoft.net>) |
Ответы |
Re: Automating Partitions in PostgreSQL - Query on syntax
Re: Automating Partitions in PostgreSQL - Query on syntax |
Список | pgsql-hackers |
2009/4/21 Dickson S. Guedes <listas@guedesoft.net>
Em Ter, 2009-04-21 às 17:20 +0530, Kedar Potdar escreveu:> Hi ,Nice. ":)
>
> We are working on a patch to automate partitioning in PostgreSQL.> (...)
> For Range partitions, we have proposed the syntax which is as
> follows
>> PARTITION BY RANGE (emp_id)What if I need more columns to set the partitions?
> (
> emp_500 (START 1 END 500),
> emp_1500 (START 500 END 1500),
> emp_4000 (START 1520 END 4000)
> );
You can do so by using command like this,
CREATE TABLE emp (
emp_id int not null primary key,
designation text not null,
location varchar(50) not null,
jdate date not null,
ctc float not null
)
PARTITION BY RANGE (jdate, emp_id)
(
emp_500 (START '01-01-1980',1 END '01-01-1990',500),
emp_1500(START '01-01-1990',500 END '01-01-2000',1500+10),
emp_4000 (START '1 Jan 2000',1500+20 END 'Jan 1, 2010', 4000-50)
);
You can have multiple columns as partition key attributes and values for these attributes should appear in the order specified.
CREATE TABLE emp (
emp_id int not null primary key,
designation text not null,
location varchar(50) not null,
jdate date not null,
ctc float not null
)
PARTITION BY RANGE (jdate, emp_id)
(
emp_500 (START '01-01-1980',1 END '01-01-1990',500),
emp_1500(START '01-01-1990',500 END '01-01-2000',1500+10),
emp_4000 (START '1 Jan 2000',1500+20 END 'Jan 1, 2010', 4000-50)
);
You can have multiple columns as partition key attributes and values for these attributes should appear in the order specified.
[]s
--
Dickson S. Guedes
mail/xmpp: guedes@guedesoft.net - skype: guediz
http://guedesoft.net - http://planeta.postgresql.org.br
В списке pgsql-hackers по дате отправления: