Re: Question on Table creation

From: sud <suds1434(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Question on Table creation
Date: 2024-02-27 19:53:57
Message-ID: CAD=mzVXPpu=_q1W61HyB25gQPE9e7G6acm0fz01L0VMo4LRDEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 21, 2024 at 5:29 AM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thiemo Kellner 2024-02-27 19:59:11 Re: Me again with an insert trigger problem
Previous Message Dominique Devienne 2024-02-27 19:01:24 Re: Cannot COPY xmin?