Search Postgresql Archives

Re: Question on Table creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 21, 2024 at 5:29 AM Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:
> 4)Never created or maintained any partition table in postgres. Here we
> want to daily range partition the both tables based on column
> "PARENT_CREATE_TIMESTAMP", so is it advisable to create the individual
> future partitions post table creation manually or through some automated
> job or we should do it using pg_partman extension? I do see a lot of
> docs around pg_partman. Would you suggest any specific doc which guides
> us to do it in an easy way.

The 'easy' way is the one you understand and can maintain. pg_partman
does a lot of the boiler plate for you so there is that. The other side
is you need to read and understand:

https://github.com/pgpartman/pg_partman/blob/master/doc/pg_partman.md



While testing the pg_partman extension I see it by default creates a "default partition" even if we provide the parameter p_start_partition as "current date". But if someone purposely doesn't want to have the default partitions , so as to avoid any unwanted data entering the table , which may be required from a data quality perspective. Is there any option in the create_parent function to achieve that? Or do we have to manually drop the default partition after getting this created through create_parent function?

I am not able to understand the significance of the "p_template_table" parameter. When we create the partitions without passing this parameter the template table gets created automatically in the partman schema. Checking the details of the template table, it doesn't show any indexes or constraints present in it, but still the child partitions get created with all the necessary indexes and constraints as those are there defined for the main table. So wondering , in what real life scenario do we really need the template table to be defined and how will it help if the partitions are different then from the main table structure?

Lastly , the template table is by default created in the partman schema but it also works without error,  if we pass the template table to be created in the application schema. So is there any downside of having the template table reside in the application schema?
 
Thanks And Regards
Sud



 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux