Re: how to avoid deadlock on masive update with multiples delete

Поиск
Список
Период
Сортировка
Искать
От
Andres Freund
Тема
Re: how to avoid deadlock on masive update with multiples delete
Дата
Msg-id
201210051736.16460.andres@2ndquadrant.com
Ответ на
Список
Дерево обсуждения
how to avoid deadlock on masive update with multiples delete "Anibal David Acosta" <aa@devshock.com>
Re: how to avoid deadlock on masive update with multiples delete Igor Neyman <ineyman@perceptron.com>
Re: how to avoid deadlock on masive update with multiples delete Jeff Janes <jeff.janes@gmail.com>
Re: how to avoid deadlock on masive update with multiples delete Claudio Freire <klaussfreire@gmail.com>
Re: how to avoid deadlock on masive update with multiples delete "Anibal David Acosta" <aa@devshock.com>
Re: how to avoid deadlock on masive update with multiples delete Maciek Sakrejda <m.sakrejda@gmail.com>
Re: how to avoid deadlock on masive update with multiples delete Tom Lane <tgl@sss.pgh.pa.us>
Re: how to avoid deadlock on masive update with multiples delete Andres Freund <andres@2ndquadrant.com>
Re: how to avoid deadlock on masive update with multiples delete Tom Lane <tgl@sss.pgh.pa.us>
Re: how to avoid deadlock on masive update with multiples delete Andres Freund <andres@2ndquadrant.com>
Re: how to avoid deadlock on masive update with multiples delete Claudio Freire <klaussfreire@gmail.com>
Re: how to avoid deadlock on masive update with multiples delete Merlin Moncure <mmoncure@gmail.com>
Re: how to avoid deadlock on masive update with multiples delete Tom Lane <tgl@sss.pgh.pa.us>
On Friday, October 05, 2012 05:31:43 PM Tom Lane wrote:
> Maciek Sakrejda  writes:
> > Presumably something like this?:
> > maciek=# CREATE TABLE test AS SELECT g, random() FROM
> > generate_series(1,1000) g;
> > CREATE
> > maciek=# EXPLAIN DELETE FROM test USING (SELECT g FROM test ORDER BY
> > ctid) x where x.g = test.g;
> 
> There's no guarantee that the planner won't re-sort the rows coming from
> the sub-select, unfortunately.
More often than not you can prevent the planner from doing that by putting a 
OFFSET 0 in the query. Not 100% but better than nothing.

We really need ORDER BY for DML.

Andres
-- 
Andres Freund		http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

В списке pgsql-performance по дате отправления
От: Tom Lane
Дата:
От: Tom Lane
Дата:
FAQ