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 1nbNcR-0005Iy-Fq for pgsql-general@arkaria.postgresql.org; Mon, 04 Apr 2022 14:23:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbNcQ-0000Gc-9k for pgsql-general@arkaria.postgresql.org; Mon, 04 Apr 2022 14:23:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbNcP-0000GL-Rm for pgsql-general@lists.postgresql.org; Mon, 04 Apr 2022 14:23:45 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nbNcN-0004Zy-1S for pgsql-general@postgresql.org; Mon, 04 Apr 2022 14:23:44 +0000 Received: by mail-ed1-x533.google.com with SMTP id x20so3432103edi.12 for ; Mon, 04 Apr 2022 07:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=nl3wz4SX9rCC4tY+ZpxGWxAsVMOwQLHZQ7dCI4D9Ixo=; b=vW+XFp7+4ROZcTAV+294B6+WklKKgGBlR0aUjDi+PEgubP/oBy1XZhiK+l4/JxD6DJ vFPRprLW/6+61fVW3vLCWLngMjoErI1RBpi/8IQRemfZVPCjOJ2WPc+z21J1gOaPQXuC D+oqgZ2lJm1VVaTWGAcXLB1eo3ZsLS3BAqt2xBxBfwIotdvlastUFnDUak4z5lLQnZtf A6u+SXUqra2wBUi9Fx3VNzoUBfMjKoA4PrjG/tAomF7+Vi57mfCIrsWBMpXzNm3lIFAK IT+Xn4qXLgoeD6xEMkfnV/4A06Q4up0lJ03d2mevwsRN4BGVOOyM/Jn6KR1n9uzYvkHc 2l9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=nl3wz4SX9rCC4tY+ZpxGWxAsVMOwQLHZQ7dCI4D9Ixo=; b=DdUdnGaphko8UJWXPSjIN2omMV6ShCEsgSAgRGa7LZ8OJ196qTFV0wKn6PM1Z0uNqk z7AEy6T6qSiCInz+wOoUsIJDwyZ3kL1aTNL8R4OUzyN0LTSmPQ22h6dFw+snEDbWTSyO wbThYWiFYTJDJU8o0/7vkODjSJcbbDgkVbyAmXSxlUo+oghzYOn28VAirUcFSwu8N6y/ OkDrOvfA/6RGFblm12TfMWxaGctOU4UCT9NlrNbS3wSJa9/VsC7Jirgk6wsUlZ2h3CBz zsCbMJJR/eMGt8RB/r4F3Ay8ZUHMTbpCJ9iNlJbVjVwXSWXy7wdN/TEA7AgYklLT3OoD 4m0w== X-Gm-Message-State: AOAM5315SBdbDUETnxm1bdBMxf6JZefGO9VTlBZqLnGHvnENUvBGh3nb f4E+i9icgP4mHJeZCBfRHVkugw== X-Google-Smtp-Source: ABdhPJxPppJwkvuQVOvPUz/VZqHLb6k7t7y3l3l5Vm5Nf228AeAcAHYUlxiFJ4Z6wqVUmdtenru+Nw== X-Received: by 2002:aa7:dd88:0:b0:41c:c008:d8e2 with SMTP id g8-20020aa7dd88000000b0041cc008d8e2mr281842edv.309.1649082221509; Mon, 04 Apr 2022 07:23:41 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:6681:831e:cb12:24cd:4c63]) by smtp.gmail.com with ESMTPSA id ga5-20020a1709070c0500b006de43e9605asm4434950ejc.181.2022.04.04.07.23.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 07:23:40 -0700 (PDT) Message-ID: <1b6e2aca7c1540db4e6437f643425da38ef93663.camel@cybertec.at> Subject: Re: Trigger functions and FDW tables From: Laurenz Albe To: Michael Nolan , "pgsql-general@postgresql.org" Date: Mon, 04 Apr 2022 16:23:40 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-3.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2022-04-04 at 09:18 -0500, Michael Nolan wrote: > Is it not recommended to use a FDW table in a trigger function? Yes, I would say that is not recommended. While a lag of a few seconds, like you describe, should not be the normal case (you should investigate that), it is hard to exclude it in the face of network failures (you could end up waiting for the keepalive timeout of 2 hours). So the trigger can potentially run a long time, which makes your transaction long. A long transaction can block other sessions or autovacuum progress. The rule of thumb is that you should have nothing inside a database transaction that *could* take a long time (even if it is normally fast). Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com