Re: Need guidance on partioning

Поиск
Список
Период
Сортировка
От Kashif Zeeshan
Тема Re: Need guidance on partioning
Дата
Msg-id CAAPsdheF-7x6Pj8akpDOqWL8Fm8uRgUbGadmDSRddmNi+eUm6A@mail.gmail.com
обсуждение исходный текст
Ответ на Need guidance on partioning  (srinivasan s <srinioracledba7@gmail.com>)
Ответы Re: Need guidance on partioning
Список pgsql-admin
Hi Srinivasan

You can use the following documentation to learn of PG Table Partitioning. 



On Wed, May 22, 2024 at 5:04 PM srinivasan s <srinioracledba7@gmail.com> wrote:
Hello everyone,

I hope you are all doing well.

I am seeking guidance on how to implement partitioning in PostgreSQL.

We have a large table that currently does not have any partitioning, and we have two requirements for removing old data from this table. We are looking to create a new table with partitioning.

1. The first requirement is to delete all records from the table that are older than 18 months. I believe we can achieve this by using range partitioning on the timestamp column.
RANGE Partition is a good option here. 

2. The second requirement is to remove data from the table when a user leaves the organization. We have the account ID and user ID in the same table.

Could someone please offer guidance on selecting the appropriate partitioning method (range, sub-partition, or composite)?
It all depends on your data structure, please go through the documentation and then analyze your table/data structure to find the appropriate method. 

Additionally, not all queries use the timestamp column in the WHERE condition. Is it mandatory to use the partition key in the WHERE condition to benefit from partitioning? Can we create a composite index that combines the partition key column with other columns used in the WHERE clause? Would this be beneficial?
Following is the limitaiton
 To create a unique or primary key constraint on a partitioned table, the partition keys must not include any expressions or function calls and the constraint's columns must include all of the partition key columns. This limitation exists because the individual indexes making up the constraint can only directly enforce uniqueness within their own partitions; therefore, the partition structure itself must guarantee that there are not duplicates in different partitions.

Thank you.




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

Предыдущее
От: Erik Wienhold
Дата:
Сообщение: Re: displaying line breaks / increasing row height in pgadmin
Следующее
От: srinivasan s
Дата:
Сообщение: Re: Need guidance on partioning