Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j9c7n-0000NP-2n for pgsql-general@arkaria.postgresql.org; Wed, 04 Mar 2020 22:04:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j9c7l-00050G-PV for pgsql-general@arkaria.postgresql.org; Wed, 04 Mar 2020 22:04:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j9c7l-0004zQ-8q for pgsql-general@lists.postgresql.org; Wed, 04 Mar 2020 22:04:17 +0000 Received: from campbell-lange.net ([178.79.140.51]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9c7i-0000yf-Rd for pgsql-general@postgresql.org; Wed, 04 Mar 2020 22:04:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=campbell-lange.net; s=it; h=Content-Type:MIME-Version:Message-ID:Subject:To :From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BBnlEqlPma10ukt0f3T0hYuSKJQHXo6mxbHrP2y1FD0=; b=unSonX+XpmAWzdOR44bZy+Sb0D fwFMrRO4zv2FuifAAXrnnxzjaNXuko9H3oiQk1MhoH0GeLbT1vmzZo7VMyeY0ntz/mi4i9I408tfF FXE4X75u3h+GKR8A9T24dfUGGWmt0HHV7xz/RM7+te1ueXVza68YkLZ7qmZtUNin1fFs=; Received: from 186.164.198.146.dyn.plus.net ([146.198.164.186] helo=rory-t450s) by campbell-lange.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9c7h-0004ak-92 for pgsql-general@postgresql.org; Wed, 04 Mar 2020 22:04:13 +0000 Received: from rory by rory-t450s with local (Exim 4.92) (envelope-from ) id 1j9c7u-0002m2-RA for pgsql-general@postgresql.org; Wed, 04 Mar 2020 22:04:26 +0000 Date: Wed, 4 Mar 2020 22:04:26 +0000 From: Rory Campbell-Lange To: pgsql-general@postgresql.org Subject: Advice request : simultaneous function/data updates on many databases Message-ID: <20200304220426.GB7232@campbell-lange.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. 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. Rory