Re: Convert Existing Table to a Partition Table in PG10

2018-06-30 Thread Clifford Snow
On Sat, Jun 23, 2018 at 6:42 PM Ravi Krishna  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


Re: dumping only table definitions

2018-06-30 Thread Vick Khera
On Fri, Jun 29, 2018 at 6:39 PM, Alvaro Herrera 
wrote:

> On 2018-Jun-29, Kevin Brannen wrote:
>
> > I'm trying to figure out how to dump only the table definitions, well
> those and things they need directly, like sequences & types. What I do NOT
> want are all the millions (not literally but it feels like it :)) of
> functions we have. Triggers would be all right if I must, as we only have a
> few of those.
>
> Try "pg_dump -Fc" followed by pg_restore -l.  You can edit the list
> emitted there, then use it with pg_restore -L.
>

>From my experience, this is the right solution.