Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 40AE27E4443 for ; Fri, 22 Jun 2012 14:28:06 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Si7eP-0005lE-Cm for pgsql-performance@postgresql.org; Fri, 22 Jun 2012 17:28:05 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5MHRpGS014313; Fri, 22 Jun 2012 13:27:51 -0400 (EDT) From: Tom Lane To: David Kerr cc: pgsql-performance@postgresql.org Subject: Re: Drop statistics? In-reply-to: <20120622170755.GB93663@mr-paradox.net> References: <20120622170755.GB93663@mr-paradox.net> Comments: In-reply-to David Kerr message dated "Fri, 22 Jun 2012 10:07:56 -0700" Date: Fri, 22 Jun 2012 13:27:51 -0400 Message-ID: <14312.1340386071@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/119 X-Sequence-Number: 47145 David Kerr writes: > I'm trying to work through a root cause on a performance problem. I'd like to > be able to "show" that a problem was fixed by analyzing the table. > what i've done is > set default_statistics_target=1 > analyze > That gets rid of most of the rows in pg_stats, but i'm still getting decent performance. I usually do something like DELETE FROM pg_statistic WHERE starelid = 'foo'::regclass; (you need to be superuser to be allowed to do this). You may need to keep an eye on whether auto-analyze is coming along and undoing what you did, too. regards, tom lane