Re: Long running INSERT+SELECT query

From: Vitaliy Garnashevich <vgarnashevich(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Long running INSERT+SELECT query
Date: 2018-04-27 16:38:15
Message-ID: 7808002c-089c-4556-52c7-0338fb864a51@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Everybody thanks for the suggestions!

We're going to try using "SELECT 1 FROM table FOR KEY SHARE" for each of
the tables, which are referenced by results, before running the big
query. That should be up to a million of rows in total. It will probably
not cover the case when a record is INSERT'ed and then DELETE'd after
the calculation has begun, but such cases should be even more rare than
the DELETE's we're currently facing.

If this will not help, we'll also try to use triggers, as mentioned
here: https://stackoverflow.com/a/39828119

Regards,
Vitaliy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fabio Ugo Venchiarutti 2018-04-27 16:54:17 Re: Can PostgreSQL create new WAL files instead of reusing old ones?
Previous Message Bruce Momjian 2018-04-27 16:28:25 Re: Can PostgreSQL create new WAL files instead of reusing old ones?