Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-13 Thread Merlin Moncure
On Fri, Jan 13, 2017 at 12:03 PM, wrote: > On Jan 12, 2017, Jonathan Vanasco wrote: >>On Jan 12, 2017, at 5:52 PM, Merlin Moncure wrote: >> >>> On Thu, Jan 12, 2017 at 2:19 PM, bto...@computer.org >>> wrote: Review manual section 7.8.2. Data-Modifying Statements in WITH

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-13 Thread
On Jan 12, 2017, Jonathan Vanasco wrote: >On Jan 12, 2017, at 5:52 PM, Merlin Moncure wrote: > >> On Thu, Jan 12, 2017 at 2:19 PM, bto...@computer.org >> wrote: >>> >>> Review manual section 7.8.2. Data-Modifying Statements in WITH >>> >>> >>> https://www.postgresql.org/docs/9.6/static/querie

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-13 Thread Jonathan Vanasco
On Jan 12, 2017, at 5:52 PM, Merlin Moncure wrote: > On Thu, Jan 12, 2017 at 2:19 PM, bto...@computer.org > wrote: >> >> Review manual section 7.8.2. Data-Modifying Statements in WITH >> >> >> https://www.postgresql.org/docs/9.6/static/queries-with.html > > this. > > with data as (delete fr

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread Merlin Moncure
On Thu, Jan 12, 2017 at 2:19 PM, bto...@computer.org wrote: > > > - Original Message - >> From: "Jonathan Vanasco" >> To: "pgsql-general general" >> Sent: Thursday, January 12, 2017 3:06:14 PM >> Subject: [GENERAL] efficiently mig

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread David G. Johnston
On Thu, Jan 12, 2017 at 2:45 PM, Adrian Klaver wrote: > > > so our migration is then based on that `is_migrate` column: > > > > BEGIN; > > UPDATE table_a__live SET is_migrate = TRUE WHERE record_timestamp > < transaction_timestamp() AT TIME ZONE 'UTC' - INTERVAL '1 month'; > > I

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread Adrian Klaver
On 01/12/2017 12:06 PM, Jonathan Vanasco wrote: > I'm just wondering if there's a more efficient way of handling a certain > periodic data migration. > > We have a pair of tables with this structure: > > table_a__live > column_1 INT > column_2 INT >

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread John R Pierce
On 1/12/2017 12:06 PM, Jonathan Vanasco wrote: I'm just wondering if there's a more efficient way of handling a certain periodic data migration. partition the tables by some date interval such as week (if you do this archiving weekly). each week, disconnect the oldest partition from the 'a

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread bto...@computer.org
- Original Message - > From: "Jonathan Vanasco" > To: "pgsql-general general" > Sent: Thursday, January 12, 2017 3:06:14 PM > Subject: [GENERAL] efficiently migrating 'old' data from one table to another > > I'm just wondering

[GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread Jonathan Vanasco
I'm just wondering if there's a more efficient way of handling a certain periodic data migration. We have a pair of tables with this structure: table_a__live column_1 INT column_2 INT record_timestamp TIMESTAMP table_a__archive