Re: autovacuum and temp tables support

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Oleg Bartunov <oleg@sai.msu.su>, Alvaro Herrera <alvherre@commandprompt.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2010-04-16T02:22:38Z
Lists: pgsql-hackers

Attachments

Robert Haas wrote:
> On Thu, Apr 8, 2010 at 3:22 PM, Oleg Bartunov <oleg@sai.msu.su> wrote:
> >> On general thought I've had is that it would be nice if the first
> >> attempt to SELECT against a table with no statistics would trigger an
> >> automatic ANALYZE by the backend on which the query was executed.
> >> It's pretty common to populate a table using INSERT, or CTAS, or COPY
> >> and then try to immediately run a query against it, and I've often
> >> found that it's necessary to insert manual analyze statements in there
> >> to get decent query plans.
> >
> > Oracle does this. So, is't worth to add support (configurable, like
> > Oracle's optimizer_dynamic_sampling) ?
> 
> Well, dynamic sampling is considerably more complicated than what I
> proposed, which is just to force an ordinary ANALYZE before the first
> query against the table.  It would be a very powerful feature if we
> could use it to ameliorate, for example, the gross statistical errors
> that sometimes occur when multiple, correlated filter conditions are
> applied to the same base table; but I don't think it's in the direct
> path of solving the present complaint.

I have added this TODO:

	Consider analyzing temporary tables when they are first used in a query
	
	    Autovacuum cannot analyze or vacuum temporary tables.
	
	        * http://archives.postgresql.org/pgsql-hackers/2010-04/msg00416.php 

I have also applied the following documentation patch to document this
behavior.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com