Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhIxz-0007R5-V7 for pgsql-hackers@arkaria.postgresql.org; Thu, 13 May 2021 21:34:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lhIxy-000407-JG for pgsql-hackers@arkaria.postgresql.org; Thu, 13 May 2021 21:33:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhIxx-0003zx-Cl for pgsql-hackers@lists.postgresql.org; Thu, 13 May 2021 21:33:58 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhIxp-0000gC-NH for pgsql-hackers@lists.postgresql.org; Thu, 13 May 2021 21:33:56 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id AE2945C0102; Thu, 13 May 2021 17:33:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 13 May 2021 17:33:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=YyGeKsxNUCk1jf8TG368d5t3lmZwz9vyBcNl5joBc7U=; b=ZJN/mP21 2jprpZjklpGFhqleSNyfkucPUR1pvPd0CMoUaZioOYuLe1I74oubOObiY9YYUNRu 3sDWY0hfaLUSBAbsNdHRthN++CAMqAYJdcYjYK5TsNHMTF2pUCBgwAmyUm87OsOE RTbbcrMNmDculjQxP3dKCJUwlusfGVgKs611VcyG8EZu7DHSPoUyrDkYT4n9Uqnh ABZrI+UlapIijWcZsMVD5hruIWNlCTKB7XLVj7/y5lTs2Ixr7QGh+OIXAxVOipEt woiyvs6cMxjVwBFDYkZPB6lvZevoQFTHbZej91PMtdSWWJayXVVcEaINULokkhWr T4FZ51oXJ4SjnA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehgedgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugfgjggfsehmkeerredtredunecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpefhfeegleekgfejueehgfefveelfeetvdehffdtueet gffhkefhudehffekudetkeenucfkphepudeltddrleehrdduledrleehnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegr lhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 May 2021 17:33:36 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E64732A0ADC; Thu, 13 May 2021 17:33:33 -0400 (-04) Date: Thu, 13 May 2021 17:33:33 -0400 From: Alvaro Herrera To: Justin Pryzby Cc: Robert Haas , Tom Lane , Zhihong Yu , pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: autovacuum: handle analyze for partitioned tables Message-ID: <20210513213333.GA31073@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210511215616.GA13282@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit New version, a bit more ambitious. I think it's better to describe behavior for partitioned tables ahead of inheritance. Also, in the ANALYZE reference page I split the topic in two: in one single paragraph we now describe what happens with manual analyze for partitioned tables and inheritance hierarchies; we describe the behavior of autovacuum in one separate paragraph for each type of hierarchy, since the differences are stark. I noticed that difference while verifying the behavior that I was to document. If you look at ANALYZE VERBOSE output, it seems a bit wasteful: create table part (a int) partition by list (a); create table part0 partition of part for values in (0); create table part1 partition of part for values in (1); create table part23 partition of part for values in (2, 3) partition by list (a); create table part2 partition of part23 for values in (2); create table part3 partition of part23 for values in (3); insert into part select g%4 from generate_series(1, 50000000) g; analyze verbose part; INFO: analyzing "public.part" inheritance tree INFO: "part1": scanned 7500 of 55310 pages, containing 1695000 live rows and 0 dead rows; 7500 rows in sample, 12500060 estimated total rows INFO: "part2": scanned 7500 of 55310 pages, containing 1695000 live rows and 0 dead rows; 7500 rows in sample, 12500060 estimated total rows INFO: "part3": scanned 7500 of 55310 pages, containing 1695000 live rows and 0 dead rows; 7500 rows in sample, 12500060 estimated total rows INFO: "part4": scanned 7500 of 55310 pages, containing 1695000 live rows and 0 dead rows; 7500 rows in sample, 12500060 estimated total rows INFO: analyzing "public.part1" INFO: "part1": scanned 30000 of 55310 pages, containing 6779940 live rows and 0 dead rows; 30000 rows in sample, 12499949 estimated total rows INFO: analyzing "public.part2" INFO: "part2": scanned 30000 of 55310 pages, containing 6779940 live rows and 0 dead rows; 30000 rows in sample, 12499949 estimated total rows INFO: analyzing "public.part34" inheritance tree INFO: "part3": scanned 15000 of 55310 pages, containing 3390000 live rows and 0 dead rows; 15000 rows in sample, 12500060 estimated total rows INFO: "part4": scanned 15000 of 55310 pages, containing 3389940 live rows and 0 dead rows; 15000 rows in sample, 12499839 estimated total rows INFO: analyzing "public.part3" INFO: "part3": scanned 30000 of 55310 pages, containing 6780000 live rows and 0 dead rows; 30000 rows in sample, 12500060 estimated total rows INFO: analyzing "public.part4" INFO: "part4": scanned 30000 of 55310 pages, containing 6780000 live rows and 0 dead rows; 30000 rows in sample, 12500060 estimated total rows ANALYZE -- Álvaro Herrera Valdivia, Chile "The eagle never lost so much time, as when he submitted to learn of the crow." (William Blake) --IS0zKkzwUGydFO0o Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-update-docs-on-analyze-on-partitioned-tables.patch"