Re: Conversion to partitioning table - Mailing list pgsql-admin

From kyle Hailey
Subject Re: Conversion to partitioning table
Date
Msg-id CADsdiQghAzon9f13U5X-DbE4_H7cxe5OYR1mtVwFRy8D3HrAuQ@mail.gmail.com
Whole thread Raw
In response to Conversion to partitioning table  (Rajesh Kumar <rajeshkumar.dba09@gmail.com>)
List pgsql-admin
CC'ing this list

On Thu, Aug 3, 2023 at 1:24 PM Rajesh Kumar <rajeshkumar.dba09@gmail.com> wrote:
>
> I have one table with three columns (id, blocknumber, jsondata) , table is about 20GB. Only one thing happens with
thistable is that, some query checks only recent block number for some activity it seems. Is partitioning the right
choice?how exactly can i partition this? 
>
> step 1: Create a new table with the same schema as existing table but as a partition table.
> step 2: Create child partition tables for them
> step 3: INSERT INTO new table SELECT*FROM OLDTABLE; ( Will this step acquire lock)
>
> This helps? or a bad idea?
>
> On Thu, 3 Aug 2023 at 13:02, kyle Hailey <kylelf@gmail.com> wrote:
>>
>> https://www.kylehailey.com/post/postgres-partition-pains-lockmanager-waits
>>
>>      Partitioning can take your production database down
>>
>> https://www.kylehailey.com/post/postgres-partition-conversion-minimal-downtime
>>
>> Basically there are 4 steps:
>> 1 Rename old table
>> 2 Create new table with partitioning
>> 3  Add constraint on old table for it's proposed partition ranges
>> 4  Attach old table as a partition to new partition table
>> Sounds easy right?
>> What about indexes? What about Triggers?
>> And guess what, there are other traps to watch out for!
>>
>>
>>
>> asd
>> <br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu,
>> Aug 3, 2023 at 12:47 PM Rajesh Kumar
>> <rajeshkumar.dba09@gmail.com> wrote:<br></div><blockquote
>> class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px
>> solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">Hi
>> friends,<div><br></div><div>I am using Redhat open shift
>> container and Postgres version 15.2. I wish to convert the normal
>> table into a partitioning table. Please help me with the
>> pre-requisite, each and every step to partition. As far as i know, we
>> can create a new partition(parent and child table) and simply insert
>> data from the old table into the new table and drop the old one. Is
>> that all?</div><div><br></div><div>Please provide me detailed answer
>> with detailed steps.</div><div><br></div><div>Thank you</div><font
>> color="#888888"><div>Kumar.</div></font></div>
>> </blockquote></div>



pgsql-admin by date:

Previous
From: kyle Hailey
Date:
Subject: Re: Conversion to partitioning table
Next
From: Kouber Saparev
Date:
Subject: Master database delaying replication