Long running INSERT+SELECT query

Поиск
Список
Период
Сортировка
От Vitaliy Garnashevich
Тема Long running INSERT+SELECT query
Дата
Msg-id 11ea9b74-243d-b275-be10-1004f51a4aa6@gmail.com
обсуждение исходный текст
Ответы Re: Long running INSERT+SELECT query  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Long running INSERT+SELECT query  (Steven Lembark <lembark@wrkhors.com>)
Список pgsql-general
Hi,

We're trying to populate a table with aggregated data from other tables. 
For that we're running a huge INSERT+SELECT query which joins several 
tables, aggregates values, and then inserts the results into another 
table. The problem we're facing is that while the query is running , 
some records in tables referenced by the results table may be deleted, 
which causes the following error:

ERROR:  insert or update on table "..." violates foreign key constraint 
"..."
DETAIL:  Key (...)=(...) is not present in table "...".

Who do we make sure that such aggregating query would not fail?

Regards,
Vitaliy




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

Предыдущее
От: Thomas Poty
Дата:
Сообщение: Re: Issue on public schéma with Pg_restore
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Long running INSERT+SELECT query