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 9E2913A57FE for ; Thu, 2 Dec 2004 16:38:53 +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 09762-01 for ; Thu, 2 Dec 2004 16:38:34 +0000 (GMT) Received: from velocity.dnsracks.com (unknown [69.93.167.170]) by svr1.postgresql.org (Postfix) with ESMTP id 7D5C13A57A2 for ; Thu, 2 Dec 2004 16:38:22 +0000 (GMT) Received: from [203.199.147.2] (helo=ps0499.persistent.co.in) by velocity.dnsracks.com with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.43) id 1CZtyF-000690-8i; Thu, 02 Dec 2004 22:08:19 +0530 From: Shridhar Daithankar To: Dmitry Karasik Subject: Re: VACUUM ANALYZE downgrades performance Date: Thu, 2 Dec 2004 22:08:57 +0530 User-Agent: KMail/1.7 Cc: pgsql-performance@postgresql.org References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> <84wtw0d6q2.fsf@plab.ku.dk> In-Reply-To: <84wtw0d6q2.fsf@plab.ku.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200412022208.57760.ghodechhap@ghodechhap.net> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - velocity.dnsracks.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - ghodechhap.net X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/52 X-Sequence-Number: 9427 On Thursday 02 Dec 2004 9:37 pm, 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? Why not? If the updates are frequent enough, that is *the* solution. But you could always use autovacuum daemon in most case. HTH Shridhar