Re: Long running INSERT+SELECT query

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Long running INSERT+SELECT query
Дата
Msg-id 20180426210458.phfgeaxsrl2f6zhk@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Long running INSERT+SELECT query  (Vitaliy Garnashevich <vgarnashevich@gmail.com>)
Список pgsql-general
Vitaliy Garnashevich wrote:
> 
> > Have not worked through all of the above, but a first draft suggestion:
> > 
> > Move the SELECT minus the aggregation functions into a sub-query that
> > uses FOR UPDATE. Then do the aggregation on the results of the
> > sub-query.
> 
> The aggregated table has hundreds of millions of rows, and the query runs
> for many hours (which is one of the reasons why it's better not to fail). I
> really doubt that row level locking would work. That would be a lot of RAM
> just to hold all the locks.

Row locks are not stored in memory.

Of course, a FOR KEY SHARE lock would block DELETEs that try to remove
the locked row.

I think your proposed strategy of trying to merge what other processes
did while you were copying is very problematic.

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


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Long running INSERT+SELECT query
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: PGAdmin4 debugger - unable to call ltree functions