X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7A2313A581A for ; Thu, 2 Dec 2004 16:28:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05266-02 for ; Thu, 2 Dec 2004 16:28:38 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 09F503A57F4 for ; Thu, 2 Dec 2004 16:27:25 +0000 (GMT) Received: from dyn-71-48.tor.dsl.tht.net (dyn-71-48.tor.dsl.tht.net [134.22.71.48]) by tht.net (Postfix) with ESMTP id E8D1A76A39; Thu, 2 Dec 2004 11:27:21 -0500 (EST) Subject: Re: VACUUM ANALYZE downgrades performance From: Rod Taylor To: Dmitry Karasik Cc: Postgresql Performance In-Reply-To: <84wtw0d6q2.fsf@plab.ku.dk> References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> <84wtw0d6q2.fsf@plab.ku.dk> Content-Type: text/plain Date: Thu, 02 Dec 2004 11:25:18 -0500 Message-Id: <1102004718.99116.220.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200412/50 X-Sequence-Number: 9425 On Thu, 2004-12-02 at 17:07 +0100, Dmitry Karasik wrote: > Hi Thomas! > > Thomas> Look at the ACTUAL TIME. It dropped from 0.029ms (using the index > Thomas> scan) to 0.009ms (using a sequential scan.) > > Thomas> Index scans are not always faster, and the planner/optimizer knows > Thomas> this. VACUUM ANALYZE is best run when a large proportion of data > Thomas> has been updated/loaded or in the off hours to refresh the > Thomas> statistics on large datasets. > > While I agree that generally this is true, look how stupid this > behavior looks in this particular case: A developer creates a table > and index, knowing that the table will be large and will be intensively > used. An admin runs 'VACUUM ANALYZE' when table is occasionally empty, > and next, say, 1 day, until another 'VACUUM ANALYZE' starts, the index > is simply not used! Sure you don't suppose to run 'VACUUM ANALYZE' every > 5 minutes as a solution, right? You might want to try this on the next 8.0 beta to come out, or against CVS. Tom recently applied some changes which should mitigate this situation. --