Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAe6j-0005YU-FP for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jun 2016 14:05:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bAe6i-0006ml-T2 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jun 2016 14:05:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bAe6i-0006me-8m for pgsql-hackers@postgresql.org; Wed, 08 Jun 2016 14:05:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bAe6b-0002WB-4A for pgsql-hackers@postgresql.org; Wed, 08 Jun 2016 14:05:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u58E4pnL018351; Wed, 8 Jun 2016 10:04:51 -0400 From: Tom Lane To: Tomasz Ostrowski cc: Jim Nasby , Josh berkus , pgsql-hackers@postgresql.org Subject: Re: [BUGS] Routine analyze of single column prevents standard autoanalyze from running at all In-reply-to: <3eebdfc2-95dc-9ede-7467-47a3c26b8892@ato.waw.pl> References: <28700.1465238280@sss.pgh.pa.us> <5755DBC2.9040007@agliodbs.com> <3d9303dc-f99c-b63c-73be-aa2214bebe73@BlueTreble.com> <26771.1465355045@sss.pgh.pa.us> <3eebdfc2-95dc-9ede-7467-47a3c26b8892@ato.waw.pl> Comments: In-reply-to Tomasz Ostrowski message dated "Wed, 08 Jun 2016 08:19:58 +0200" Date: Wed, 08 Jun 2016 10:04:51 -0400 Message-ID: <18350.1465394691@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Tomasz Ostrowski writes: > W dniu 2016-06-08 o 05:04, Tom Lane pisze: >> Yeah, my guess is that the OP's example where analyzing just one column >> was significantly cheaper boiled down to some of the other columns being >> mostly toasted data. Otherwise it's hard to see how there's much more >> expense in analyzing them all. > Actually no - this volatile column has smaller "statistics" than most of > the table, so analyzing it is much faster when it's data is not in RAM. Oh, so you *will* be vulnerable to the side-effect we wondered about earlier, wherein the manual ANALYZE scans fewer blocks and may therefore derive a less-accurate tuple count estimate than auto-analyze gets. It'll be interesting to see how the fix plays out for you --- please pay attention to whether the pg_stat_all_tables.n_live_tup/n_dead_tup numbers jump around in unexpected ways. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers