Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jLiD4-0001Ch-Vx for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 06:59:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLiD3-0003zp-8c for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 06:59:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jLiD3-0003zi-1S for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 06:59:45 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLiCv-0002H0-OX for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 06:59:44 +0000 Received: by mail-wr1-x442.google.com with SMTP id g3so2566665wrx.2 for ; Mon, 06 Apr 2020 23:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=thcvuUufLjwJpP/H1c99/KDtIvZ+ZxYFA2TprGLY1a0=; b=omZ3HyvGagqyMVLL0te1LeHbsHfBRHjPQkC2OEyJp+sqviPykbN2WIw9xkLqYSYg40 pjX5gVncYNu6Jfqwrdug4sX1cn7op3i9hIBMwpKm/XkjCMaz7fOWBhGtZ+A/MF1B6MUU ZHJhRmQC/YQ81awuepEa8aiYbY3bPii9cHayJ3RNm8WxO4Ly7ICFl7E3te7MNnU4dmZL kEDQfOG8PrlQevWXO3AG72W3kQybZAWEvA3XqbW80yuLz9QqqdN8RS628HR5ZzJLidTP NralUOwv3qhB2VAO/Qp0nHbGoUKJxZaaTjZ7kDZ2CWmAbsuQqE2zDEPIskF515H6bB9K x5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=thcvuUufLjwJpP/H1c99/KDtIvZ+ZxYFA2TprGLY1a0=; b=Xry/HPLEPUm+pEN8nO4r9aN1F/95uAmsvwIMDSah5iVxc5Z8t/6a8q2lEOhMrJNzv/ wJMMFN8NEtPjMigr5EKiqd7agxmXfFUT6WEsghyk8eW6JwgYu4WXyDeBIuu1T/KQTYe6 campI4R8ThCGubEYXRDe5shGbBwDLwnqiq32Rr+nHr5Wm+c9qbPRY90w5vtWj78762QT 6waXMMCJcXa2WOOiQ4+dCJVjf1Z/+t4dmPn2z5/731G0mEDBukOu3hVhm5yznS14CvGS /7I+kdDB5mDLSL7gsZiUZ4j9VR/bcHu0S18MpsxgHbO3tRdNJNGhztj9LbfCRoV52qrM wbZw== X-Gm-Message-State: AGi0PubDTJKuyln7xI9pxdfbFpTsA49BHvr0gpuF59cqAGqe8CAPFDE1 3aBZOTnMv+ygfDfwoX9gsxygkQ== X-Google-Smtp-Source: APiQypK4ieKosU8kqGeJNa2zFqCT2Io83EQjsPNR1jYQcbHdGyBdT9HvoYJWTpBG1Sjru+k4Gwlyng== X-Received: by 2002:adf:e611:: with SMTP id p17mr1037402wrm.384.1586242776603; Mon, 06 Apr 2020 23:59:36 -0700 (PDT) Received: from dynamic-eo9lc8043u2qr9u6l-pd01.res.v6.highway.a1.net (dynamic-eo9lc8043u2qr9u6l-pd01.res.v6.highway.a1.net. [2001:871:60:9a62:6597:76d3:1e4c:440d]) by smtp.gmail.com with ESMTPSA id o129sm1119162wma.20.2020.04.06.23.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 23:59:36 -0700 (PDT) Message-ID: Subject: Re: what happens when you issue ALTER SERVER in a hot environment? From: Laurenz Albe To: Tom Lane , "David G. Johnston" Cc: AC Gomez , "pgsql-generallists.postgresql.org" Date: Tue, 07 Apr 2020 08:59:34 +0200 In-Reply-To: <25511.1586235191@sss.pgh.pa.us> References: <25511.1586235191@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 2020-04-07 at 00:53 -0400, Tom Lane wrote: > "David G. Johnston" writes: > > On Monday, April 6, 2020, AC Gomez wrote: > > > If you issue an ALTER SERVER command and there are active connections > > > with that server in use or new ones are coming in, what happens? Docs on > > > this command say nothing regarding active processing using the server > > > context and changes to it. So I assume it's just handled. > > Not sure if there are exceptions but assume that nothing external will > > change your current active session’s settings out from underneath you. > > Couple of comments here: > > * ALTER SERVER changes nothing until "pg_ctl reload" or similar is > issued. I think you both mixed up ALTER SYSTEM and ALTER SERVER. The details of when exactly an ALTER SERVER will affect a query that uses a foreign table on the server will vary depending on the implementation of the foreign data wrapper, but typically the settings that were in effect when the query was *planned* will be the ones used. Typically, queries are planned right before they are executed. Any query that is currently executing will continue to do so, but queries planned after the ALTER SERVER will use the new values. Sometimes plans are cached, but all cached plans that involve the changed server will be invalidated and re-planned after the ALTER SERVER. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com