pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Advice request : simultaneous function/data updates on many databases
Date: Wed, 4 Mar 2020 16:41:32 -0600
Message-ID: <212985ab-5e3a-a9a6-44d8-9ad5afbf6524@gmail.com> (raw)
In-Reply-To: <20200304223342.GA11628@campbell-lange.net>
References: <20200304220426.GB7232@campbell-lange.net>
	<7ce9074f-0468-1cc8-3337-018b66e56679@aklaver.com>
	<20200304222257.GA11376@campbell-lange.net>
	<42b4d82b-d468-3f9e-c021-c20bcc141245@aklaver.com>
	<20200304223342.GA11628@campbell-lange.net>

On 3/4/20 4:33 PM, Rory Campbell-Lange wrote:
> On 04/03/20, Adrian Klaver (adrian.klaver@aklaver.com) wrote:
>> On 3/4/20 2:22 PM, Rory Campbell-Lange wrote:
>>> On 04/03/20, Adrian Klaver (adrian.klaver@aklaver.com) wrote:
>>>> On 3/4/20 2:04 PM, Rory Campbell-Lange wrote:
>>>>> We have many databases of the same type separated for data governance
>>>>> reasons. They, however, share the same web front-end code.
>>>>>
>>>>> Presently, replacing functions and performing data updates on the
>>>>> databases in series often executes across all databases in less than a
>>>>> minute. (The updates are currently done with simple sql files connecting
>>>>> to each database and then loading a stub file pointing to each function
>>>>> to drop and reload, and running the data update queries.)
>>>>>
>>>>> However, for larger updates, the time when the front end code is
>>>>> out-of-step with the database can cause end-user problems.
>>>> So the issue is synchronization between the code in the database and the
>>>> code outside the database?
>>>>
>>>> I'm assuming the problems are changes in function signatures and return
>>>> values?
>>> That is one problem; sometimes we also need to make some table
>>> definition or data changes.
>> Alright, but the general issue is that the world as seen by the database can
>> be different from that seen by the front end code.
>>
>> So the solution is to make those world views sync, or am I missing
>> something?
> Essentially we wish to reduce the window where the frontend and backend
> aren't synchronised.
>
> If we have (for example) 200 databases which each take 2 seconds to
> update, a client could be on the wrong frontend code for over 6 minutes.

The only solution to that is parallel updates (not all 200 at once!!) with a 
progress bar.

>>>>> Unfortunately our schema arrangement isn't clean enough to swap out
>>>>> function schemas in a transaction to sort out that part of the problem
>>>>> (if in fact that would work anyway).
>>>>>
>>>>> One solution might be to do the updates in parallel. Another thought
>>>>> would be to somehow execute the code update from a text field in a table
>>>>> in each database triggered with pg_cron.
>>>>>
>>>>> Bearing in mind the possible problems of connection saturation or
>>>>> massive IO spikes, I'd be grateful to learn of any thoughts on how to
>>>>> negotiate this problem.
>

-- 
Angular momentum makes the world go 'round.





view thread (18+ messages)  latest in thread

Message-ID: <212985ab-5e3a-a9a6-44d8-9ad5afbf6524@gmail.com>
Permalink:  ../212985ab-5e3a-a9a6-44d8-9ad5afbf6524@gmail.com/
Also on:    postgresql.org/message-id/212985ab-5e3a-a9a6-44d8-9ad5afbf6524@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: ronljohnsonjr@gmail.com
  Subject: Re: Advice request : simultaneous function/data updates on many databases
  In-Reply-To: <212985ab-5e3a-a9a6-44d8-9ad5afbf6524@gmail.com>
  References: <20200304220426.GB7232@campbell-lange.net> <7ce9074f-0468-1cc8-3337-018b66e56679@aklaver.com> <20200304222257.GA11376@campbell-lange.net> <42b4d82b-d468-3f9e-c021-c20bcc141245@aklaver.com> <20200304223342.GA11628@campbell-lange.net> <212985ab-5e3a-a9a6-44d8-9ad5afbf6524@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