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 1lF82P-0001Do-7Q for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Feb 2021 04:14:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lF82N-0006J8-FB for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Feb 2021 04:14:03 +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 1lF82N-0006Ip-1z for pgsql-hackers@lists.postgresql.org; Thu, 25 Feb 2021 04:14:03 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lF82H-0007BS-9b for pgsql-hackers@lists.postgresql.org; Thu, 25 Feb 2021 04:14:00 +0000 Received: by mail-il1-x131.google.com with SMTP id f10so3237662ilq.5 for ; Wed, 24 Feb 2021 20:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qasX1Sk9RYBqmaQuN3rqmCm33jR1lH9Pgsj6wN7OR+w=; b=qbtMhlPD+sFcxoxIQ9nhIx3VoyHJ2MKEt7ypsBx4QZVqkyzlPEcMU+eLeCVcwr/wnl kte0Wid9x6ZMRwXeFBk2wl/0imshOcbgPUgHwfhppiaPyZTomZJati56wWzjj+gDmidO rKZqCwxT3xKwgSLgG91B3BEAI0rzMmEFcozI+qxyessrFYAnHW6x1wFgBTXWZHblspmx ObyQpKQZJo6FMTCuDab1cJhjX1agJVcjj74HKuT19u/s9kNNV/mAwMld4wsMQ9ink9Av gHlBL2bK0qnGYxBF2OC3yBU/k4grsHD9vIlJVep19AMU6t2r1EhB83G8BZDUxb1wMgwc shew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qasX1Sk9RYBqmaQuN3rqmCm33jR1lH9Pgsj6wN7OR+w=; b=TU7WR+RhbYJzlMuDzijMBYxd+c4sekiXUxHjpjEFJtqsusdYyCPzjH0pD24SGWtDbJ rG9+MEvmMS7pejx8QGMUYROui8xbbiRJln3j3OCh/2VDiKr9SSa5UzQJg5C8qZSCo/z2 O8QtKMYXrv0wdUeTJOxZ9kxk/UPl+ey75fYQa8xRGsu5IfkplfLwreev8neEBRvUrYOJ YUeaebutNJfu5sJXQnOM6PiC8sTg6GBRB88nNfImotE28v2roef4wTdG04G6elIACr3l gbYzK+pzJppicOdfaaCeItaM10wfrHjlrYVPpdOQOiUEug025HSk15HyhpfsJzaPTrS3 Eslw== X-Gm-Message-State: AOAM532Fs0uvxObVGTr4QxTC2uowdWcBerLGQkhrBBzUbO27QV13z30V IH48YY2ZILmKb4m5hcJfANTE0Q== X-Google-Smtp-Source: ABdhPJxnU8yFvTtNKiM6Kj8Sr9rXXP2oBXgdvKX/BGQIGfy0mcWAUuWtPPfGIj/VelPMQ5Blaaq9kA== X-Received: by 2002:a05:6e02:1d88:: with SMTP id h8mr827759ila.43.1614226434477; Wed, 24 Feb 2021 20:13:54 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k8sm2523869ilu.4.2021.02.24.20.13.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Feb 2021 20:13:53 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id C5B41800783; Wed, 24 Feb 2021 22:13:52 -0600 (CST) Date: Wed, 24 Feb 2021 22:13:52 -0600 From: Justin Pryzby To: Peter Geoghegan Cc: Masahiko Sawada , PostgreSQL Hackers , Heikki Linnakangas Subject: Re: 64-bit XIDs in deleted nbtree pages Message-ID: <20210225041352.GK20769@telsasoft.com> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 22, 2021 at 02:54:54PM -0800, Peter Geoghegan wrote: > On Mon, Feb 22, 2021 at 4:21 AM Masahiko Sawada wrote: > > The 0001 patch looks good to me. In the documentation, I think we need > > to update the following paragraph in the description of > > vacuum_cleanup_index_scale_factor: > > Good point. I think that the structure should make the page deletion > triggering condition have only secondary importance -- it is only > described at all to be complete and exhaustive. The > vacuum_cleanup_index_scale_factor-related threshold is all that users > will really care about in this area. > > The reasons for this are: it's pretty rare to have many page > deletions, but never again delete/non-hot update even one single > tuple. But when that happens, it's *much* rarer still to *also* have > inserts, that might actually benefit from recycling the deleted page. > So it's very narrow. > > I think that I'll add a "Note" box that talks about the page deletion > stuff, right at the end. It's actually kind of an awkward thing to > describe, and yet I think we still need to describe it. > > I also think that the existing documentation should clearly point out > that the vacuum_cleanup_index_scale_factor only gets considered when > there are no updates or deletes since the last VACUUM -- that seems > like an existing problem worth fixing now. It's way too unclear that > this setting only really concerns append-only tables. e5d8a999030418a1b9e53d5f15ccaca7ed674877 | I (pgeoghegan) have chosen to remove any mention of deleted pages in the | documentation of the vacuum_cleanup_index_scale_factor GUC/param, since | the presence of deleted (though unrecycled) pages is no longer of much | concern to users. The vacuum_cleanup_index_scale_factor description in | the docs now seems rather unclear in any case, and it should probably be | rewritten in the near future. Perhaps some passing mention of page | deletion will be added back at the same time. I think 8e12f4a25 wasn't quite aggressive enough in its changes, and I had another patch laying around. I rebased and came up with this. diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 9851ca68b4..5da2e705b9 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -8522,24 +8522,26 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; Specifies [-the fraction-]{+a multiplier+} of the total number of heap tuples[-counted in-] [- the previous statistics collection-] that can be inserted [-without-]{+before+} incurring an index scan at the VACUUM cleanup stage. This setting currently applies to B-tree indexes only. [-If-]{+During VACUUM, if there are+} no {+dead+} tuples [-were deleted from-]{+found while+} {+ scanning+} the heap, [-B-tree-]{+then the index vacuum phase is skipped.+} {+ However,+} indexes [-are-]{+might+} still {+be+} scanned [-at-]{+during+} the[-VACUUM-] cleanup [-stage when-]{+phase. Setting this+} {+ parameter enables+} the [-index's-]{+possibility to skip scanning indexes during cleanup.+} {+ Indexes will always be scanned when their+} statistics are stale. Index statistics are considered {+to be+} stale if the number of newly inserted tuples exceeds the vacuum_cleanup_index_scale_factor [-fraction-]{+multiplier+} of the total number of heap tuples [-detected by-]{+at the time of+} the previous [-statistics collection.-]{+vacuum cleanup.+} The total number of heap tuples is stored in the index meta-page. Note that the meta-page does not include this data until VACUUM finds no dead tuples, so B-tree index [-scan-]{+scans+} at the cleanup stage [-can only-]{+cannot+} be skipped [-if the second and-] [- subsequent VACUUM cycles detect-]{+until after a vacuum cycle+} {+ which detects+} no dead tuples. --IS0zKkzwUGydFO0o Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-fix-vacuum_cleanup_index_scale_factor.patch" From 44cf90c5b06fb21c2c4d379568b9fe86a54f1530 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sun, 15 Mar 2020 13:06:02 -0500 Subject: [PATCH] fix: vacuum_cleanup_index_scale_factor --- doc/src/sgml/config.sgml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 9851ca68b4..5da2e705b9 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -8522,24 +8522,26 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; - Specifies the fraction of the total number of heap tuples counted in - the previous statistics collection that can be inserted without - incurring an index scan at the VACUUM cleanup stage. + Specifies a multiplier of the total number of heap tuples that can be + inserted before incurring an index scan at the VACUUM + cleanup stage. This setting currently applies to B-tree indexes only. - If no tuples were deleted from the heap, B-tree indexes are still - scanned at the VACUUM cleanup stage when the - index's statistics are stale. Index statistics are considered - stale if the number of newly inserted tuples exceeds the - vacuum_cleanup_index_scale_factor - fraction of the total number of heap tuples detected by the previous - statistics collection. The total number of heap tuples is stored in + During VACUUM, if there are no dead tuples found while + scanning the heap, then the index vacuum phase is skipped. + However, indexes might still be scanned during the cleanup phase. Setting this + parameter enables the possibility to skip scanning indexes during cleanup. + Indexes will always be scanned when their statistics are stale. + Index statistics are considered to be stale if the number of newly + inserted tuples exceeds the vacuum_cleanup_index_scale_factor + multiplier of the total number of heap tuples at the time of the previous + vacuum cleanup. The total number of heap tuples is stored in the index meta-page. Note that the meta-page does not include this data until VACUUM finds no dead tuples, so B-tree index - scan at the cleanup stage can only be skipped if the second and - subsequent VACUUM cycles detect no dead tuples. + scans at the cleanup stage cannot be skipped until after a vacuum cycle + which detects no dead tuples. -- 2.17.0 --IS0zKkzwUGydFO0o--