diff options
author | David Rowley <drowley@postgresql.org> | 2023-04-06 12:37:03 +1200 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2023-04-06 12:37:03 +1200 |
commit | bccd6908ca82c6cba0c76b669bc81fc9f3fb60cd (patch) | |
tree | 281bb4d68669793ef53c9435361f3cd90e3bee1b | |
parent | 1d477a907e63941b58508136f92ac0b5058b68ab (diff) | |
download | postgresql-bccd6908ca82c6cba0c76b669bc81fc9f3fb60cd.tar.gz postgresql-bccd6908ca82c6cba0c76b669bc81fc9f3fb60cd.zip |
Always make a BufferAccessStrategy for ANALYZE
32fbe0239 changed things so we didn't bother allocating the
BufferAccessStrategy during VACUUM (ONLY_DATABASE_STATS); and VACUUM
(FULL), however, it forgot to consider that VACUUM (FULL, ANALYZE) is a
possible combination. That change would have resulted in such a command
allowing ANALYZE to make full use of shared buffers, which wasn't
intended, so fix that.
Reported-by: Melanie Plageman
Discussion: https://postgr.es/m/CAAKRu_bJRKe+v_=OqwC+5sA3j5qv8rqdAwy3+yHaO3wmtfrCRg@mail.gmail.com
-rw-r--r-- | src/backend/commands/vacuum.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index da85330ef40..2c31745fbc4 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -393,11 +393,13 @@ vacuum(List *relations, VacuumParams *params, * If caller didn't give us a buffer strategy object, make one in the * cross-transaction memory context. We needn't bother making this for * VACUUM (FULL) or VACUUM (ONLY_DATABASE_STATS) as they'll not make use - * of it. + * of it. VACUUM (FULL, ANALYZE) is possible, so we'd better ensure that + * we make a strategy when we see ANALYZE. */ if (bstrategy == NULL && - (params->options & (VACOPT_ONLY_DATABASE_STATS | - VACOPT_FULL)) == 0) + ((params->options & (VACOPT_ONLY_DATABASE_STATS | + VACOPT_FULL)) == 0 || + (params->options & VACOPT_ANALYZE) != 0)) { MemoryContext old_context = MemoryContextSwitchTo(vac_context); |