From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Partitioning an existing table - pg10.6
Date: Wed, 3 Jul 2019 11:35:01 +0300
Message-ID: <c3d8e3c1-db04-7b4f-561d-5e73f8c9e770@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAOS0qEsT0E3KqWTeGOU-=e38PYwpTXmgzyuEvHG4-yUhTAoMzA@mail.gmail.com>
References: <CAOS0qEsT0E3KqWTeGOU-=e38PYwpTXmgzyuEvHG4-yUhTAoMzA@mail.gmail.com>
On 3/7/19 10:01 π.μ., Ayub M wrote:
> Hello, I am using postgres 10.6 and have a huge table with ~30m recs which needs to be partitioned. Whats the best strategy for it with minimal downtime?
>
> 1. Rename existing table and create new partitioned tables with orig name and keep inserting data from the old renamed to new table. This will incur downtime for the apps.
> 2. Create partitioned table with new name and move the data from current table (move oldest to newest) and when moving current month paritition shutdown down the app and move the last set of data.
> This will not incur downtime but if any data is changed which was already copied over then it might be lost.
Regarding 2) you could setup a trigger on the original table which would also replicate INSERTS, DELETES and UPDATES to the new table.
>
> Any other approaches/alternatives?
>
> --
> Regards,
> Ayub
--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: achill@matrix.gatewaynet.com
Subject: Re: Partitioning an existing table - pg10.6
In-Reply-To: <c3d8e3c1-db04-7b4f-561d-5e73f8c9e770@matrix.gatewaynet.com>
References: <CAOS0qEsT0E3KqWTeGOU-=e38PYwpTXmgzyuEvHG4-yUhTAoMzA@mail.gmail.com> <c3d8e3c1-db04-7b4f-561d-5e73f8c9e770@matrix.gatewaynet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox