Re: Long running INSERT+SELECT query

From: Tim Cross <theophilusx(at)gmail(dot)com>
To: Steven Lembark <lembark(at)wrkhors(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Long running INSERT+SELECT query
Date: 2018-04-27 22:04:49
Message-ID: 87lgd8cnlq.fsf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Steven Lembark <lembark(at)wrkhors(dot)com> writes:

> On Fri, 27 Apr 2018 19:38:15 +0300
> Vitaliy Garnashevich <vgarnashevich(at)gmail(dot)com> wrote:
>
>> 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.
>
> Thing about using a couple of Materialized Views for the worst
> part of it.

+1 re: materialised views - I have found them to be extremely useful for
situations where you want a snapshot of data and need to present it in a
way which is easier to process, especially when the underlying data is
changing faster than your reporting process can generate the report.

--
Tim Cross

In response to

Browse pgsql-general by date

  From Date Subject
Next Message g@luxsci.net 2018-04-27 22:52:39 Re: Rationale for aversion to the central database?
Previous Message Merlin Moncure 2018-04-27 20:36:30 Re: Rationale for aversion to the central database?