Re: Running analysis as part of a stored proc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ioannis Anagnostopoulos <ioannis(at)anatec(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Running analysis as part of a stored proc
Date: 2012-07-28 20:00:58
Message-ID: 20115.1343505658@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Ioannis Anagnostopoulos <ioannis(at)anatec(dot)com> writes:
> Is it advisable to include a VACUUM ANALYZE <table name> within a stored
> procedure that runs as part of a batch every night?

If you're envisioning this as cleanup after the day's activities,
autovacuum will almost certainly make that unnecessary.

The typical cases where you need a manual vacuum or analyze in a stored
proc are where you need the cleanup or new stats immediately and can't
wait for autovacuum to get around to it. So if this is a step in a
process where you just modified the table heavily and you need the
cleanup done before you get to the next step, then yes it'd make sense.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ioannis Anagnostopoulos 2012-07-30 08:39:42 Re: Running analysis as part of a stored proc
Previous Message Ioannis Anagnostopoulos 2012-07-28 19:19:22 Running analysis as part of a stored proc