Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WsnsQ-0007iZ-IS for pgsql-performance@arkaria.postgresql.org; Fri, 06 Jun 2014 06:43:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WsnsP-0004Zb-WA for pgsql-performance@arkaria.postgresql.org; Fri, 06 Jun 2014 06:43:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WsnsN-0004ZS-7T for pgsql-performance@postgresql.org; Fri, 06 Jun 2014 06:43:43 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WsnsE-0003Sk-Io for pgsql-performance@postgresql.org; Fri, 06 Jun 2014 06:43:40 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WsnsC-0007QF-N1 for pgsql-performance@postgresql.org; Thu, 05 Jun 2014 23:43:32 -0700 Date: Thu, 5 Jun 2014 23:43:32 -0700 (PDT) From: tim_wilson To: pgsql-performance@postgresql.org Message-ID: <1402037012706-5806302.post@n5.nabble.com> In-Reply-To: <1402016119875-5806283.post@n5.nabble.com> References: <1400459729388-5804416.post@n5.nabble.com> <11299.1400559202@sss.pgh.pa.us> <1402016119875-5806283.post@n5.nabble.com> Subject: Re: 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: 1.8 (+) 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 I have now created a repeatable test for this ...bug, well that may be debatable, but getting the query plan this wrong after vacum and analyze have run certainly looks like a bug to me. I have created a test case that matches my problem domain but can probably be simplified. postgres_bug.sql Even after autovac vacuum and autovac analyze have run the query plan goes from using indexes on the big table to table scanning them as it thinks my unit_test table is large due to the error in the estimate for rows in the table that autovac generated. Once you run a cluster on the table all goes back to using the correct indexes. And the next autovacuum gets things straight again on the stats table. Look forward to solution as this is hurting us. A very hot table on our system goes bad every night and needs constant watching. regards Tim -- View this message in context: http://postgresql.1045698.n5.nabble.com/autovacuum-vacuum-creates-bad-statistics-for-planner-when-it-log-index-scans-0-tp5804416p5806302.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