v8-0002-Don-t-make-vacuum-strategy-ring-when-unused.patch
text/x-patch
Filename: v8-0002-Don-t-make-vacuum-strategy-ring-when-unused.patch
Type: text/x-patch
Part: 3
Patch
Format: format-patch
Series: patch v8-0002
Subject: Don't make vacuum strategy ring when unused
| File | + | − |
|---|---|---|
| src/backend/commands/vacuum.c | 3 | 1 |
From 8f0af2e3b7f2db10f8d5c4013da7dcf71b6a3d0d Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Sun, 2 Apr 2023 10:28:09 -0400
Subject: [PATCH v8 2/6] Don't make vacuum strategy ring when unused
VACUUM FULL and VACUUM ONLY_DATABASE_STATS will not use the vacuum
strategy ring created in vacuum(), so don't waste time and memory making
it. It is worth noting that VACUUM (PROCESS_MAIN false, PROCESS_TOAST
false) will also not use it, but that doesn't seem worth handling
specifically.
---
src/backend/commands/vacuum.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 4f7c132c2f..0cc9c31523 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -396,7 +396,9 @@ vacuum(List *relations, VacuumParams *params,
* If caller didn't give us a buffer strategy object, make one in the
* cross-transaction memory context.
*/
- if (bstrategy == NULL)
+ if (bstrategy == NULL &&
+ !(params->options & VACOPT_ONLY_DATABASE_STATS ||
+ params->options & VACOPT_FULL))
{
MemoryContext old_context = MemoryContextSwitchTo(vac_context);
--
2.37.2