From 6feb09201e5b4d8f89bfb34f3450dbe060679bc8 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 23 Mar 2007 20:56:39 +0000 Subject: [PATCH] We no longer need to palloc the VacuumStmt node; keeping it on the stack is simpler. --- src/backend/postmaster/autovacuum.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3c82b83ca0..42420525b6 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1237,32 +1237,28 @@ static void autovacuum_do_vac_analyze(Oid relid, bool dovacuum, bool doanalyze, int freeze_min_age) { - VacuumStmt *vacstmt; + VacuumStmt vacstmt; MemoryContext old_cxt; /* - * The node must survive transaction boundaries, so make sure we create it + * The list must survive transaction boundaries, so make sure we create it * in a long-lived context */ old_cxt = MemoryContextSwitchTo(AutovacMemCxt); - vacstmt = makeNode(VacuumStmt); - /* Set up command parameters */ - vacstmt->vacuum = dovacuum; - vacstmt->full = false; - vacstmt->analyze = doanalyze; - vacstmt->freeze_min_age = freeze_min_age; - vacstmt->verbose = false; - vacstmt->relation = NULL; /* not used since we pass a relids list */ - vacstmt->va_cols = NIL; + vacstmt.vacuum = dovacuum; + vacstmt.full = false; + vacstmt.analyze = doanalyze; + vacstmt.freeze_min_age = freeze_min_age; + vacstmt.verbose = false; + vacstmt.relation = NULL; /* not used since we pass a relids list */ + vacstmt.va_cols = NIL; /* Let pgstat know what we're doing */ - autovac_report_activity(vacstmt, relid); - - vacuum(vacstmt, list_make1_oid(relid), true); + autovac_report_activity(&vacstmt, relid); - pfree(vacstmt); + vacuum(&vacstmt, list_make1_oid(relid), true); MemoryContextSwitchTo(old_cxt); } -- 2.39.5