Re: Convert Existing Table to a Partition Table in PG10

From: Clifford Snow <clifford(at)snowandsnow(dot)us>
To: srkrishna(at)yahoo(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Convert Existing Table to a Partition Table in PG10
Date: 2018-06-30 22:15:44
Message-ID: CADAoPLp18iezMoEbbUnXA5H21eTF6YGtFzKrTbQ3WZRMQwUM6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jun 23, 2018 at 6:42 PM Ravi Krishna <srkrishna(at)yahoo(dot)com> wrote:

> Does this help:
> http://ashutoshpg.blogspot.com/2018/06/upgrade-your-partitioning-from.html
>
> Ravi,
Thanks. I used Ashutosh Bapa's blop post as a guideline.

For others attempting this, I first created my parent and child structure.
Then inserted the data from the original table into the child tables. Once
I was happy with my new structure I drop the original table. (which is
still backed just in case)

I found a couple of areas I'd missed on reading about partitions. First, no
primary key. That was a big surprise. Second, my triggers I use to catch
information going into the table, needed to be pointed at the child tables.
I also leaned that my range partition value I used on a timestamp needed to
have fractional seconds. I used a range of 2017-01-01 00:00:00 to
2017-23:59:59 which failed when I attempted to add a record that had a
timestamp of 2017-23:59:59. Adding a fractional second to the range solved
the problem.

Clifford

--
@osm_seattle
osm_seattle.snowandsnow.us
OpenStreetMap: Maps with a human touch

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2018-07-01 09:00:57 Re: Convert Existing Table to a Partition Table in PG10
Previous Message Vick Khera 2018-06-30 16:11:47 Re: dumping only table definitions