Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WmBYG-0004uN-JS for pgsql-performance@arkaria.postgresql.org; Mon, 19 May 2014 00:35:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WmBYE-0005mo-MT for pgsql-performance@arkaria.postgresql.org; Mon, 19 May 2014 00:35:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WmBYD-0005mh-Ey for pgsql-performance@postgresql.org; Mon, 19 May 2014 00:35:33 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WmBYB-0004Jx-1n for pgsql-performance@postgresql.org; Mon, 19 May 2014 00:35:32 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WmBY9-0002uU-Gg for pgsql-performance@postgresql.org; Sun, 18 May 2014 17:35:29 -0700 Date: Sun, 18 May 2014 17:35:29 -0700 (PDT) From: tim_wilson To: pgsql-performance@postgresql.org Message-ID: <1400459729388-5804416.post@n5.nabble.com> Subject: autovacuum vacuum creates bad statistics for planner when it log index scans: 0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 2.6 (++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On a 9.3.1 server , I have a key busy_table in that is hit by most transactions running on our system. One DB's copy of this table has 60K rows and 1/3 of that tables rows can updated every minute. Autovacuum autovacuum_analyze_scale_factor is set 0.02, so that analyse runs nearly every minute. But when autovacuum vacuum runs I sometimes see the following message in logs: LOG: automatic vacuum of table "busy_table":* index scans: 0* pages: 0 removed, 22152 remain tuples: 0 removed, 196927 remain buffer usage: 46241 hits, 478 misses, 715 dirtied avg read rate: 0.561 MB/s, avg write rate: 0.839 MB/s system usage: CPU 0.07s/0.06u sec elapsed 6.66 sec and the tuples remaining is then overestimated by a factor >3 , and have seen this over estimate as large at >20 times IE 5M This causes the query planner to then fail to get the best plan, in fact this can result in queries that take 30 Minutes that normally return in 4-6 seconds. IE it starts table scanning tables in joins to busy_table rather than using the index. As soon as following appears: LOG: automatic vacuum of table "busy_table": *index scans: 1* all is well again for the queries that follow this , but for the 20-30 user interactions during the bad period never return as they take too long. -- View this message in context: http://postgresql.1045698.n5.nabble.com/autovacuum-vacuum-creates-bad-statistics-for-planner-when-it-log-index-scans-0-tp5804416.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance