mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 12:31:23 +02:00
Only make buffer strategy for vacuum when it's likely needed
VACUUM FULL and VACUUM ONLY_DATABASE_STATS will not use the vacuum strategy ring created in vacuum(), so don't waste effort making it in those cases. There are other conceivable cases where the buffer strategy also won't be used, but those are probably less common and not worth troubling over too much. For example VACUUM (PROCESS_MAIN false, PROCESS_TOAST false). There are other cases too, but many of these are only discovered once inside vacuum_rel(). Author: Melanie Plageman Reviewed-by: David Rowley Discussion: https://postgr.es/m/CAAKRu_ZLRuzkM3zKogiZAz2hUony37yLY4aaLb8fPf8fgqs5Og@mail.gmail.com
This commit is contained in:
parent
1980d3585e
commit
32fbe0239b
@ -393,7 +393,9 @@ vacuum(List *relations, VacuumParams *params,
|
|||||||
* If caller didn't give us a buffer strategy object, make one in the
|
* If caller didn't give us a buffer strategy object, make one in the
|
||||||
* cross-transaction memory context.
|
* 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);
|
MemoryContext old_context = MemoryContextSwitchTo(vac_context);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user