ANALYSE on top-level of partitioned tables - required?

From: Toby Corkindale <toby(dot)corkindale(at)strategicdata(dot)com(dot)au>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: ANALYSE on top-level of partitioned tables - required?
Date: 2012-03-06 04:52:29
Message-ID: 4F55980D.2080307@strategicdata.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Say you have a master table which has many partitioned tables, created
like this:

CREATE TABLE foo (various columns...);
CREATE TABLE foo_1 () INHERITS foo;
CREATE TABLE foo_2 () INHERITS foo;

Now lets say you insert data directly into foo_X, eg with
COPY foo_1 FROM...
COPY foo_1 FROM...

Do you need to manually call ANALYZE manually on foo for PostgreSQL to
build statistics on it?

I remember seeing something in the documentation about how the
auto-analyser won't realise it needs to run on top-level tables because
as far as its concerned, there have been no changes to it..

But, I wondered if that matters? I mean, since there's no data in it,
but all the child tables are analysed, is that enough?

My experience so far indicates that it DOES matter (looking at query
plans before and after calling ANALYSE), but I'd like to get some
opinions from those more knowledgeable than I..

thanks in advance,
Toby

Browse pgsql-general by date

  From Date Subject
Next Message Piyush Lenka 2012-03-06 06:22:39 pg_dump : no tables were found.
Previous Message Chris Travers 2012-03-06 03:11:57 Re: Lost data Folder, but have WAL files--- How to recover the database ?? Windows