pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: Steven Lembark <lembark@wrkhors.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Long running INSERT+SELECT query
Date: Sat, 28 Apr 2018 08:04:49 +1000
Message-ID: <87lgd8cnlq.fsf@gmail.com> (raw)
In-Reply-To: <20180427145041.031abeda.lembark@wrkhors.com>
References: <11ea9b74-243d-b275-be10-1004f51a4aa6@gmail.com>
	<a596f16f-e665-6d03-2e92-bed2e276bb68@aklaver.com>
	<ce1a27f4-6085-6be4-8b9e-08598fd7e5eb@gmail.com>
	<39121e73-b04a-77c4-cb5f-55530e82f0d3@aklaver.com>
	<f2b804fc-bd9a-fcf4-f3bd-cb1b129daab4@gmail.com>
	<320a63d9-71b5-90d1-fd2c-9ed408ae1016@aklaver.com>
	<5893718d-4449-741f-671a-aea1ee654944@gmail.com>
	<20180427093027.6959987e@wrkhors.com>
	<7808002c-089c-4556-52c7-0338fb864a51@gmail.com>
	<20180427145041.031abeda.lembark@wrkhors.com>


Steven Lembark <lembark@wrkhors.com> writes:

> On Fri, 27 Apr 2018 19:38:15 +0300
> Vitaliy Garnashevich <vgarnashevich@gmail.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




view thread (16+ messages)

Message-ID: <87lgd8cnlq.fsf@gmail.com>
Permalink:  ../87lgd8cnlq.fsf@gmail.com/
Also on:    postgresql.org/message-id/87lgd8cnlq.fsf@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: theophilusx@gmail.com, lembark@wrkhors.com
  Subject: Re: Long running INSERT+SELECT query
  In-Reply-To: <87lgd8cnlq.fsf@gmail.com>
  References: <11ea9b74-243d-b275-be10-1004f51a4aa6@gmail.com> <a596f16f-e665-6d03-2e92-bed2e276bb68@aklaver.com> <ce1a27f4-6085-6be4-8b9e-08598fd7e5eb@gmail.com> <39121e73-b04a-77c4-cb5f-55530e82f0d3@aklaver.com> <f2b804fc-bd9a-fcf4-f3bd-cb1b129daab4@gmail.com> <320a63d9-71b5-90d1-fd2c-9ed408ae1016@aklaver.com> <5893718d-4449-741f-671a-aea1ee654944@gmail.com> <20180427093027.6959987e@wrkhors.com> <7808002c-089c-4556-52c7-0338fb864a51@gmail.com> <20180427145041.031abeda.lembark@wrkhors.com> <87lgd8cnlq.fsf@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox