Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu2mR-0004dk-J8 for pgsql-performance@arkaria.postgresql.org; Fri, 20 Dec 2013 16:18:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vu2mQ-0003mc-Uk for pgsql-performance@arkaria.postgresql.org; Fri, 20 Dec 2013 16:18:26 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu2mQ-0003mW-2K for pgsql-performance@postgresql.org; Fri, 20 Dec 2013 16:18:26 +0000 Received: from smtp2.peak6.com ([38.98.137.9]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu2mM-0008W4-0D for pgsql-performance@postgresql.org; Fri, 20 Dec 2013 16:18:24 +0000 X-AuditID: 0a02cb20-b7fab6d000000b57-68-52b46dcd8537 Received: from sswchi5pcas2.peak6.net (Unknown_Domain [10.100.13.24]) by smtp2.peak6.com (Symantec Messaging Gateway) with SMTP id A4.D1.02903.DCD64B25; Fri, 20 Dec 2013 10:18:21 -0600 (CST) Received: from [10.10.201.64] (10.10.201.64) by sswchi5pcas2.peak6.net (10.100.13.25) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 20 Dec 2013 10:18:21 -0600 Message-ID: <52B46DCD.2070107@optionshouse.com> Date: Fri, 20 Dec 2013 10:18:21 -0600 From: Shaun Thomas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Alvaro Herrera , Dave Johansen CC: Scott Marlowe , Jeff Janes , pgsql-performance Subject: Re: Recommendations for partitioning? References: <20131220155954.GB22570@eldon.alvh.no-ip.org> In-Reply-To: <20131220155954.GB22570@eldon.alvh.no-ip.org> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.201.64] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplleLIzCtJLcpLzFFi42LhSuGV0D2buyXI4NdGFYtVx9cxW/xv+8No Me37ISaL6zPPMVss+3Se0YHV4/fdg0weO2fdZfe4sG8aewBzVAOjTWJeXn5JYkmqQkpqcbKt kn9BSWZ+XrFHfmlxqoJLZnFyTmJmbmqRkkJmiq2SsZJCQU5icmpual6JrVJiQUFqXoqSHZcC BrABKsvMU0jNS85PycxLt1XyDPbXtbAwtdQ1VLKLRwYJnSwZi+dNYS54wVKxc/4HxgbG08xd jJwcEgImEhsnrWeFsMUkLtxbz9bFyMUhJHCAUeLGzJdMEM5KIGfiTkaQKl4BfYkF25+AdbMI qEosn/MHLM4moCsxqX8FG4gtKhAm0X5hJjNEvaDEyZlPWLoYOThEBMIl/j6VB5nJLNDGKPFu /3t2kBphAQuJltMNrBDLJjFL/PywGGwQp4CVxPIX18AWMAvYSlyYc50FwpaX2P52DtgCIaAj VjRPZIN4QUHi/5V3TBMYhWYh2T0LSfssJO0LGJlXMYoXlyUmZ2SaFRTnlhQY6RWkJmab6eWl lmxiBMU502mFHYybe6wOMQpwMCrx8DZkbgkSYk0sK67MPcQowcGsJMK7GSTEm5JYWZValB9f VJqTWnyI0QcYOBOZpUST84EpKK8k3tDY1MDU0tTQ1NzU0AiHsJI4L1fO1CAhgXRgQslOTS1I LYIZx8TBKdXAGPXuM2NOA3/Bttvhv08FrVr/yFWr6YOBD1/GpB13JhxPLfs55/rFrdUu4rsq zr6xvro+zOqLSe6Pgyarf5t/vM/UtaSdc6r9naZ9Gmpy6b9kxK4E1zG0WTSelX4vOkuvTr9w qdXcA3LnJ87tTjubKqO6PiBb3zxS5fvVtxZiXu4pXQ/3ZSfwKLEUZyQaajEXFScCAO64G8Yg AwAA X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org 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. :) -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-676-8870 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance