Re: add PROCESS_MAIN to VACUUM

2023-03-07 Thread Michael Paquier
On Tue, Mar 07, 2023 at 12:55:08PM -0800, Nathan Bossart wrote: > On Tue, Mar 07, 2023 at 12:39:29PM -0500, Melanie Plageman wrote: >> Yes, sounds clear to me also! > > Here is an updated patch. Fine by me, so done. (I have cut a few words from the comment, without changing its meaning.) --

Re: add PROCESS_MAIN to VACUUM

2023-03-07 Thread Nathan Bossart
On Tue, Mar 07, 2023 at 12:39:29PM -0500, Melanie Plageman wrote: > Yes, sounds clear to me also! Here is an updated patch. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 580f966499..0acc42af2b

Re: add PROCESS_MAIN to VACUUM

2023-03-07 Thread Melanie Plageman
On Mon, Mar 6, 2023 at 10:45 PM Michael Paquier wrote: > > On Mon, Mar 06, 2023 at 04:59:49PM -0800, Nathan Bossart wrote: > > That did cross my mind, but I was worried that trying to explain all that > > here could cause confusion. > > > > If PROCESS_MAIN is set (the default), it's time to

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Michael Paquier
On Mon, Mar 06, 2023 at 04:59:49PM -0800, Nathan Bossart wrote: > That did cross my mind, but I was worried that trying to explain all that > here could cause confusion. > > If PROCESS_MAIN is set (the default), it's time to vacuum the main > relation. Otherwise, we can skip this

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Nathan Bossart
On Tue, Mar 07, 2023 at 09:20:12AM +0900, Michael Paquier wrote: > -* Do the actual work --- either FULL or "lazy" vacuum > +* If PROCESS_MAIN is set (the default), it's time to vacuum the main > +* relation. Otherwise, we can skip this part. If required, we'll > process > +*

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Michael Paquier
On Mon, Mar 06, 2023 at 06:12:36PM -0500, Melanie Plageman wrote: > LGTM. -* Do the actual work --- either FULL or "lazy" vacuum +* If PROCESS_MAIN is set (the default), it's time to vacuum the main +* relation. Otherwise, we can skip this part. If required, we'll process +* the

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Melanie Plageman
On Mon, Mar 6, 2023 at 5:43 PM Nathan Bossart wrote: > > On Mon, Mar 06, 2023 at 05:09:58PM -0500, Melanie Plageman wrote: > > I would move this comment inside of the outer if statement since it is > > distinguishing between the two branches of the inner if statement. > > Oops, done. > > > Also,

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Melanie Plageman
On Mon, Mar 06, 2023 at 01:13:37PM -0800, Nathan Bossart wrote: > On Mon, Mar 06, 2023 at 03:48:28PM -0500, Melanie Plageman wrote: > > On Mon, Mar 6, 2023 at 3:27 PM Nathan Bossart > > wrote: > >> On Mon, Mar 06, 2023 at 02:40:09PM -0500, Melanie Plageman wrote: > >> > I noticed in vacuum_rel()

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Nathan Bossart
On Mon, Mar 06, 2023 at 03:48:28PM -0500, Melanie Plageman wrote: > On Mon, Mar 6, 2023 at 3:27 PM Nathan Bossart > wrote: >> On Mon, Mar 06, 2023 at 02:40:09PM -0500, Melanie Plageman wrote: >> > I noticed in vacuum_rel() in vacuum.c where table_relation_vacuum() is >> > called, 4211fbd84

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Melanie Plageman
On Mon, Mar 6, 2023 at 3:27 PM Nathan Bossart wrote: > > On Mon, Mar 06, 2023 at 02:40:09PM -0500, Melanie Plageman wrote: > > I noticed in vacuum_rel() in vacuum.c where table_relation_vacuum() is > > called, 4211fbd84 changes the else into an else if [1]. I understand > > after reading the

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Nathan Bossart
On Mon, Mar 06, 2023 at 02:40:09PM -0500, Melanie Plageman wrote: > I noticed in vacuum_rel() in vacuum.c where table_relation_vacuum() is > called, 4211fbd84 changes the else into an else if [1]. I understand > after reading the commit and re-reading the code why that is now, but I > was

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Melanie Plageman
On Mon, Mar 06, 2023 at 09:37:23AM -0800, Nathan Bossart wrote: > On Mon, Mar 06, 2023 at 04:51:46PM +0900, Michael Paquier wrote: > > That was mostly OK for me, so applied after tweaking a couple of > > places in the tests (extra explanations, for one), the comments and > > the code. I noticed

Re: add PROCESS_MAIN to VACUUM

2023-03-06 Thread Nathan Bossart
On Mon, Mar 06, 2023 at 04:51:46PM +0900, Michael Paquier wrote: > That was mostly OK for me, so applied after tweaking a couple of > places in the tests (extra explanations, for one), the comments and > the code. Thanks! -- Nathan Bossart Amazon Web Services: https://aws.amazon.com

Re: add PROCESS_MAIN to VACUUM

2023-03-05 Thread Michael Paquier
On Wed, Mar 01, 2023 at 10:53:59PM -0800, Nathan Bossart wrote: > I don't feel a strong need for that, especially now that we aren't > modifying params anymore. That was mostly OK for me, so applied after tweaking a couple of places in the tests (extra explanations, for one), the comments and the

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Nathan Bossart
63a536fc4aa044d6d1b663ce28b6ef0c36f7 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Thu, 29 Dec 2022 15:31:49 -0800 Subject: [PATCH v6 1/1] add PROCESS_MAIN to VACUUM --- doc/src/sgml/ref/vacuum.sgml | 13 ++ doc/src/sgml/ref/vacuumdb.sgml | 15 +++ src/backend/co

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Michael Paquier
On Wed, Mar 01, 2023 at 09:26:37AM -0800, Nathan Bossart wrote: > Thanks for taking a look. > > On Wed, Mar 01, 2023 at 03:31:48PM +0900, Michael Paquier wrote: > > PROCESS_TOAST has that: > > /* sanity check for PROCESS_TOAST */ > > if ((params->options & VACOPT_FULL) != 0 && > >

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Masahiko Sawada
On Thu, Mar 2, 2023 at 2:26 PM Nathan Bossart wrote: > > On Thu, Mar 02, 2023 at 02:21:08PM +0900, Michael Paquier wrote: > > On Thu, Mar 02, 2023 at 12:58:32PM +0900, Masahiko Sawada wrote: > >> Cutting the toast relation name to 'pg_toast' is a bit confusing to me > >> as we have the pg_toast

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Nathan Bossart
ossart Amazon Web Services: https://aws.amazon.com >From 221d46e7aacaf289ef001a6f61cc16c8e1046e2a Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Thu, 29 Dec 2022 15:31:49 -0800 Subject: [PATCH v5 1/1] add PROCESS_MAIN to VACUUM --- doc/src/sgml/ref/vacuum.sgml | 13 ++ doc/s

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Michael Paquier
On Thu, Mar 02, 2023 at 12:58:32PM +0900, Masahiko Sawada wrote: > Cutting the toast relation name to 'pg_toast' is a bit confusing to me > as we have the pg_toast schema. How about using the following query > instead to improve the readability? > >SELECT >CASE WHEN c.relname IS

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Masahiko Sawada
On Thu, Mar 2, 2023 at 4:13 AM Nathan Bossart wrote: > > On Wed, Mar 01, 2023 at 07:09:53PM +0100, Alvaro Herrera wrote: > > On 2023-Mar-01, Michael Paquier wrote: > > > >> +-- PROCESS_MAIN option > >> +VACUUM (PROCESS_MAIN FALSE) vactst; > >> +VACUUM (PROCESS_MAIN FALSE, PROCESS_TOAST FALSE)

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Michael Paquier
On Wed, Mar 01, 2023 at 07:09:53PM +0100, Alvaro Herrera wrote: > Maybe instead of reading the log, read values from pg_stat_all_tables. Ah, right. I was looking at pg_stat_user_tables yesterday, and forgot that pg_stat_all_tables tracks toast tables, so it should be fine to do some validation

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Nathan Bossart
ebf1a052472de307f36b20a5a1414b Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Thu, 29 Dec 2022 15:31:49 -0800 Subject: [PATCH v4 1/1] add PROCESS_MAIN to VACUUM --- doc/src/sgml/ref/vacuum.sgml | 13 ++ doc/src/sgml/ref/vacuumdb.sgml | 15 +++ src/backend/commands/

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Alvaro Herrera
On 2023-Mar-01, Michael Paquier wrote: > +-- PROCESS_MAIN option > +VACUUM (PROCESS_MAIN FALSE) vactst; > +VACUUM (PROCESS_MAIN FALSE, PROCESS_TOAST FALSE) vactst; > +VACUUM (PROCESS_MAIN FALSE, FULL) vactst; > > Thinking a bit here. This set of tests does not make sure that the > main relation

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Nathan Bossart
Thanks for taking a look. On Wed, Mar 01, 2023 at 03:31:48PM +0900, Michael Paquier wrote: > PROCESS_TOAST has that: > /* sanity check for PROCESS_TOAST */ > if ((params->options & VACOPT_FULL) != 0 && > (params->options & VACOPT_PROCESS_TOAST) == 0) > ereport(ERROR, >

Re: add PROCESS_MAIN to VACUUM

2023-02-28 Thread Michael Paquier
On Thu, Jan 19, 2023 at 11:08:07AM -0800, Nathan Bossart wrote: > rebased PROCESS_TOAST has that: /* sanity check for PROCESS_TOAST */ if ((params->options & VACOPT_FULL) != 0 && (params->options & VACOPT_PROCESS_TOAST) == 0) ereport(ERROR,

Re: add PROCESS_MAIN to VACUUM

2023-02-20 Thread Nathan Bossart
On Mon, Feb 20, 2023 at 10:31:11AM -0600, Justin Pryzby wrote: > On Fri, Jan 13, 2023 at 03:30:15PM -0800, Nathan Bossart wrote: >> On Fri, Jan 13, 2023 at 03:24:09PM -0800, Jeff Davis wrote: >> > For completeness, did you consider CLUSTER and REINDEX options as well? >> >> I have not, but I can

Re: add PROCESS_MAIN to VACUUM

2023-02-20 Thread Justin Pryzby
On Fri, Jan 13, 2023 at 03:30:15PM -0800, Nathan Bossart wrote: > On Fri, Jan 13, 2023 at 03:24:09PM -0800, Jeff Davis wrote: > > For completeness, did you consider CLUSTER and REINDEX options as well? > > I have not, but I can put together patches for those as well. Are you planning to do that

Re: add PROCESS_MAIN to VACUUM

2023-01-19 Thread Nathan Bossart
2001 From: Nathan Bossart Date: Thu, 29 Dec 2022 15:31:49 -0800 Subject: [PATCH v3 1/1] add PROCESS_MAIN to VACUUM --- doc/src/sgml/ref/vacuum.sgml | 13 + doc/src/sgml/ref/vacuumdb.sgml | 15 +++ src/backend/commands/vacuum.c| 28 ++--

Re: add PROCESS_MAIN to VACUUM

2023-01-19 Thread vignesh C
On Sat, 7 Jan 2023 at 10:37, Nathan Bossart wrote: > > rebased for cfbot The patch does not apply on top of HEAD as in [1], please post a rebased patch: === Applying patches on top of PostgreSQL commit ID d540a02a724b9643205abce8c5644a0f0908f6e3 === === applying patch

Re: add PROCESS_MAIN to VACUUM

2023-01-13 Thread Nathan Bossart
On Fri, Jan 13, 2023 at 03:24:09PM -0800, Jeff Davis wrote: > For completeness, did you consider CLUSTER and REINDEX options as well? I have not, but I can put together patches for those as well. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com

Re: add PROCESS_MAIN to VACUUM

2023-01-13 Thread Jeff Davis
On Thu, 2022-12-29 at 16:00 -0800, Nathan Bossart wrote: > The motivation for adding this option is to make it easier to VACUUM > only a > relation's TOAST table.  At the moment, you need to find the TOAST > table by > examining a relation's reltoastrelid, and you need USAGE on the > pg_toast >

Re: add PROCESS_MAIN to VACUUM

2023-01-06 Thread Nathan Bossart
rebased for cfbot -- Nathan Bossart Amazon Web Services: https://aws.amazon.com >From 7e72b0a9f06fdfa00d5320d4c3303e67788878aa Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Thu, 29 Dec 2022 15:31:49 -0800 Subject: [PATCH v2 1/1] add PROCESS_MAIN to VACUUM --- doc/src/sgml/

add PROCESS_MAIN to VACUUM

2022-12-29 Thread Nathan Bossart
:00 2001 From: Nathan Bossart Date: Thu, 29 Dec 2022 15:31:49 -0800 Subject: [PATCH v1 1/1] add PROCESS_MAIN to VACUUM --- doc/src/sgml/ref/vacuum.sgml | 13 + doc/src/sgml/ref/vacuumdb.sgml | 15 +++ src/backend/commands/vacuum.c|