Re: Recommendations for partitioning?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Dave Johansen <davejohansen(at)gmail(dot)com>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Recommendations for partitioning?
Date: 2013-12-20 15:59:54
Message-ID: 20131220155954.GB22570@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dave Johansen escribió:
> On Thu, Dec 19, 2013 at 10:27 AM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>wrote:

> > That's pretty much it. What I did was to create the new month table
> > and day tables, alter my triggers to reflect this, then move the data
> > with insert into / select from query for each old day partition. Then
> > once their data is moved you can just drop them. Since you changed the
> > triggers first those tables are no long taking input so it's usually
> > safe to drop them now.
>
> It would be nice if there was just a "move command", but that seems like
> the type of model that we want and we'll probably move to that.

Eh. Why can't you just do something like

WITH moved AS (
DELETE FROM src WHERE ..
RETURNING *
) INSERT INTO dst SELECT * FROM moved;

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message bricklen 2013-12-20 16:07:22 Re: Recommendations for partitioning?
Previous Message Dave Johansen 2013-12-20 15:52:51 Re: Recommendations for partitioning?