Re: Recommendations for partitioning? - Mailing list pgsql-performance

From Dave Johansen
Subject Re: Recommendations for partitioning?
Date
Msg-id CAAcYxUec197ZbYoMms4DvUpX1yH425d=ypehppY9hzogpxwCfw@mail.gmail.com
Whole thread Raw
In response to Re: Recommendations for partitioning?  (Shaun Thomas <sthomas@optionshouse.com>)
List pgsql-performance
On Fri, Dec 20, 2013 at 9:18 AM, Shaun Thomas <sthomas@optionshouse.com> wrote:
On 12/20/2013 09:59 AM, Alvaro Herrera wrote:

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

I know that's effectively an atomic action, but I'd feel a lot more comfortable reversing that logic so the delete is based on the results of the insert.

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

I'll admit yours is cleaner, though. :)

That is a good idea. I didn't even realize that there was such a command, so I'll definitely use those.

pgsql-performance by date:

Previous
From: Shaun Thomas
Date:
Subject: Re: Recommendations for partitioning?
Next
From: Dave Johansen
Date:
Subject: Re: Recommendations for partitioning?