Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TWTyt-0000Od-Qi for pgsql-admin@postgresql.org; Thu, 08 Nov 2012 15:25:23 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TWTys-0005Ea-Iz for pgsql-admin@postgresql.org; Thu, 08 Nov 2012 15:25:23 +0000 Received: by mail-pa0-f46.google.com with SMTP id hz1so2055804pad.19 for ; Thu, 08 Nov 2012 07:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Oy+sdlscru/s6HoQZehQhhqzIoX85YcIEwtL+A2F2iY=; b=Jv/2bt6D0Lpf8WV+yGehhyMUo1RSGlBmG4eTxNEP52RvyPAdth2bCUXejU42ZrULfk hBbDkKMagLq+eXhrMWZ5nZ2GpFpE6ay8bM0tVbb/rr94zMrHSEwbnUyIO7sKmxkU25mS aE21ud44FEasTCeIJIT87M3FqV6tKVUZZ5lg+gELIE6mgbc97y0mrWQGdoUhCrv8lo+D cClpoQR0SevaIkbVzVKeq5QGKWvP/6p0RSwcaLtJScLahmCjHoVlLjI4TIM/78r1US/3 7tIcdyXUOmCri5F49UB9j0qpMFJojRW9daxfL+WUjwsEy3lJCSEqR3eiO3iXXYr7GN6c acbw== Received: by 10.68.193.228 with SMTP id hr4mr18497110pbc.95.1352388322036; Thu, 08 Nov 2012 07:25:22 -0800 (PST) Received: from [192.168.11.3] ([114.95.126.189]) by mx.google.com with ESMTPS id j8sm16276723paz.30.2012.11.08.07.25.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Nov 2012 07:25:21 -0800 (PST) Message-ID: <509BCECC.6030108@gmail.com> Date: Thu, 08 Nov 2012 23:25:00 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Albe Laurenz CC: pgsql-admin@postgresql.org Subject: Re: analyze log question on parent/children tables References: <509BBCB0.7050502@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201211/51 X-Sequence-Number: 40296 Got it. Thanks. 于2012年11月8日 23:21:33,Albe Laurenz写到: > Rural Hunter wrote: >> I'm on 9.1.3. I set auto vacuum off for some tables. I noticed one >> thing: when I run manual analyze on parent table, It seems the > children >> tables are also analyzed. Here is the analyze log: >> >> INFO: analyzing "public.table_parent" >> INFO: "table_parent": scanned 0 of 0 pages, containing 0 live rows > and >> 0 dead rows; 0 rows in sample, 0 estimated total rows >> INFO: analyzing "public.table_parent" inheritance tree >> INFO: "table_child1": scanned 11405 of 692945 pages, containing > 105632 >> live rows and 103 dead rows; 11405 rows in sample, 10739605 estimated >> total rows >> INFO: "table_child2": scanned 1858 of 112866 pages, containing 35818 >> live rows and 0 dead rows; 1858 rows in sample, 2178974 estimated > total rows >> .... >> >> But when I check the table status in pgAdmin, I noticed the (auto) >> analyze time of children tables was not logged. So my question here > is: >> should I run a separate analyze on children tables? > > This ANALYZE will only collect statistics for the parent. > If you look in pg_stats, you might find two sets of entries > for the parent table, one with inherited=TRUE and one with > inherited=FALSE. > The hierarchy is scanned for the former values. > > If you collect statistics manually, you should also run ANALYZE > on the child tables. > > Of course, if you use autovacuum, the right things should happen > (except that autovacuum doesn't seem to update the inherited > statistics for the parent table). > > Yours, > Laurenz Albe >