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 1nH6Zz-0001KM-Sk for pgsql-admin@arkaria.postgresql.org; Mon, 07 Feb 2022 16:09:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nH6Zy-0007eW-Qh for pgsql-admin@arkaria.postgresql.org; Mon, 07 Feb 2022 16:09:26 +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 1nH6Zy-0007eM-EL for pgsql-admin@lists.postgresql.org; Mon, 07 Feb 2022 16:09:26 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nH6Zv-0006rd-D5 for pgsql-admin@lists.postgresql.org; Mon, 07 Feb 2022 16:09:26 +0000 Received: by mail-ed1-x535.google.com with SMTP id bx2so14804051edb.11 for ; Mon, 07 Feb 2022 08:09:23 -0800 (PST) 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=SD/OyShaZC7t19/uI5o4TVVKNo0r3WUUwGoX0WzU3UU=; b=bXgruFn2ft/qkNfrwo8a7suJFnMkHf/yb0bBdYo6JXWv33Zmp0yT8sw7wGlc0icREo 9x2HyPRROYOLOvjsa27QBSjKjmjG3FbRKyWyr6rUYYYcpTcFDt5Var8usqOn6bE30J69 qQgZMMSc3Uupe7bl08r5lTdx/HHGlbVRJYnd8bLz92Xc++l2gOEXOJo+BYQRw+0RwoOT SRsKr/zDJ8yzATcGVHD8gajnfLCv84f//8MMTPPlgGaSMZEN1fpdS5efuJ47XUM59p24 EVdkIDX3Chu31Cq5TSgbrKqoU+4fgEwfpGwCFUkYhn2+CIr6J/WOK2OS24IMqHqlpKBm MvwQ== 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=SD/OyShaZC7t19/uI5o4TVVKNo0r3WUUwGoX0WzU3UU=; b=sXhyr/ijoKaNaIya2je/OGa+Ne8Tuy1yZHARtSe1rzFcSSisZwU0TFuwfinon5ky/0 /Jusf/88EK0Msz3nEObrTMS2w3dXeo7rB4mJukPmCwGaHzjv+a3rTHXOdjkJMrD1eRTq UyIqG4Lzr3QQivL1pndNAvBEnbR6X46oQS2nNu4IjceFcjHHSPylVPy1pQsw7c0y5ewy QyKEBC4zJQcqN+6btLXAdtzMQ9XBWgX/1bc3vWRz6GDpvUkpuKyqn9JKnOEyEU2HxKFz q6LyiAnWfsun74w9+tk6gUSqqFyKZRIzpqiWxBVsZJRPpnGqoU70TF1wkAV54kZyVtVM Y7EQ== X-Gm-Message-State: AOAM531JUBDZdl4tDqMzKbUaFVkMZ1sX5YSGJq5iXT5AVQP/7Zix8UWH jNGrV1PrbYMHB7oEvFgteNlJqg== X-Google-Smtp-Source: ABdhPJzB+iM9+WvQ3sSvOfux2R7AEY2DBf9UqBNkCl5nrOlDJASC23gY5pPQyFSqZcSV0WLjf1FjIw== X-Received: by 2002:a05:6402:5110:: with SMTP id m16mr154830edd.325.1644250161914; Mon, 07 Feb 2022 08:09:21 -0800 (PST) Received: from localhost.localdomain ([2001:871:5e:9a17:909d:9f4e:64af:27a]) by smtp.gmail.com with ESMTPSA id n25sm1985408eds.89.2022.02.07.08.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 08:09:21 -0800 (PST) Message-ID: <9a196c5db21caadb873493439011e4959d387ffe.camel@cybertec.at> Subject: Re: autovacuum default run with vacuum_index_cleanup and vacuum_truncate and related lock? From: Laurenz Albe To: "James Pang (chaolpan)" , "pgsql-admin@lists.postgresql.org" Date: Mon, 07 Feb 2022 17:09:20 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2022-02-07 at 08:43 +0000, James Pang (chaolpan) wrote: > It’s Postgres 13 version, we plan to migrate from Oracle to Postgres 13 on RHEL8. > One maintain job is about autovacuum, with default config,  autovacuum will do on > tables with  “vacuum_index_cleanup” and “vacuum_truncate” option? > With both options, autovacuum woker will hold “access exclusive” lock when truncate > empty blocks and cleanup index ?  if that’s true, how to handle autovacuum to reduce > the lock blocking issue? Cleaning up the index will not take any locks that block data modifications. The ACCESS EXCLUSIVE lock for truncation is only held for a very short time and won't bother you (unless perhaps, you could get replication conflicts on a standby server). Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com