Re: Recommendations for partitioning?

Поиск
Список
Период
Сортировка
От Shaun Thomas
Тема Re: Recommendations for partitioning?
Дата
Msg-id 52B46DCD.2070107@optionshouse.com
обсуждение исходный текст
Ответ на Re: Recommendations for partitioning?  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: Recommendations for partitioning?  (Dave Johansen <davejohansen@gmail.com>)
Список pgsql-performance
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


В списке pgsql-performance по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Recommendations for partitioning?
Следующее
От: Dave Johansen
Дата:
Сообщение: Re: Recommendations for partitioning?