Re: Bulk Insert/Update Scenario

Поиск
Список
Период
Сортировка
От Mana M
Тема Re: Bulk Insert/Update Scenario
Дата
Msg-id CAJAiPv5GxqKJ4LsZsXo2Hi9kKCdfqxuNRocVVFwJ1zXTKOK=yQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Bulk Insert/Update Scenario  (Jordan Deitch <jwdeitch@gmail.com>)
Ответы Re: Bulk Insert/Update Scenario  (Jordan Deitch <jwdeitch@gmail.com>)
Re: Bulk Insert/Update Scenario  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Список pgsql-general
Thanks Jordan.

One more question I had was - anyway to avoid doing individual INSERT ... ON CONFLICT? I was thinking about dumping everything into TEMP table and using that as source for INSERT ... ON CONFLICT. However, I was not sure on how to get thousands of rows from my Python application into TEMP table in one shot. Or is there any better alternatives?

Thanks.

On Thu, Jan 4, 2018 at 12:43 PM, Jordan Deitch <jwdeitch@gmail.com> wrote:
Hi Mana, 

A starting point would be reading about the batch upsert functionality:

You would do something like:
INSERT INTO table ON CONFLICT update... 

This operation would be atomic. You can also look into deferrable constraints such that you would perform all your insert / update operations in a transaction block and accommodate for the constraints. 

I hope this helps to get you on the right track!

Thanks,
Jordan Deitch



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

Предыдущее
От: legrand legrand
Дата:
Сообщение: Re: Bulk Insert/Update Scenario
Следующее
От: Jordan Deitch
Дата:
Сообщение: Re: Bulk Insert/Update Scenario