Re: How to add partitions to the existing table in PostgreSQL

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: How to add partitions to the existing table in PostgreSQL
Дата
Msg-id f0b04f2b-1eab-4123-5593-90e494a2a274@gmx.net
обсуждение исходный текст
Ответ на How to add partitions to the existing table in PostgreSQL  (Naveen Kumar <naveenmcp@gmail.com>)
Список pgsql-admin
Naveen Kumar schrieb am 06.10.2020 um 08:31:
> How to add partitions to the existing table in PostgreSQL
>
> for ex, below is my table definition:
>
> CREATE TABLE ot.employee
> (
>     empno smallint NOT NULL,
>     ename character varying(20),
>     job character varying(20),
>     deptno smallint
> )
>
> Now I would like to add partition to deptno column
>
> I don't see any alter table command to add the partition to the existing table.

I seriously doubt a table named "employee" needs partitioning.

Partitioning serves essentially two purposes:

1) quickly delete large amount of data (millions of rows) by simply dropping a partition (I highly doubt this is a use
casefor a table named employee). 

2) Improve performance if all queries (or nearly all) include the partitioning key in their WHERE clause and thus only
afraction of the table needs to be read - but this only shows an effect if we are talking about millions or tens of
millionsof rows. Again something I doubt would be necessary for a table named employee. And all queries that do not
includethe partitioning key will be slower on the partitioned table! 

What problem are you trying to solve by partitioining that table?

Thomas



В списке pgsql-admin по дате отправления:

Предыдущее
От: Naveen Kumar
Дата:
Сообщение: Re: How to return multiple rows by stored procedure in postgresql
Следующее
От: Ashok Kumar Tiwari
Дата:
Сообщение: checkpoint and recovering process use too much memory