Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 3F6BCB5DBD0 for ; Thu, 12 May 2011 17:07:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 45791-01-4 for ; Thu, 12 May 2011 20:07:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mail.postgresql.org (Postfix) with ESMTP id 62188B5DC1F for ; Thu, 12 May 2011 17:06:58 -0300 (ADT) Received: from [192.168.1.3] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MNyEJ-1QNc9s2zPf-007Ug3; Thu, 12 May 2011 22:06:56 +0200 Message-ID: <4DCC3DD9.4000402@2ndquadrant.com> Date: Thu, 12 May 2011 16:06:49 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Tomas Vondra CC: pgsql-performance@postgresql.org Subject: Re: since when has pg_stat_user_indexes.idx_scan been counting? References: <4DCC24BD.9040900@fuzzy.cz> In-Reply-To: <4DCC24BD.9040900@fuzzy.cz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:HI0wlCr6S6zp/RLkX+0K18JON0DgobiLNcC3eY3j6EL znhKKoFWAviX19wyiQ2BosTQ4O/J5MZ03fovLNdSHbCaunZU8R kDh5tLVyctg4Mr10XrHdjO0knSGPYB/KLoyIzE2nqLTly5+CkC P/q03Ai0sBewmHsZohA+tZRUjh4dwDOlWuwkdAHMmxlbsfmajL lBaGPaWYj/YGZPtYMDWj+EIQPDWy11M9dIuu9oQak8= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201105/188 X-Sequence-Number: 43697 Tomas Vondra wrote: > BTW it's really really tricky to remove indexes once they're created. > What if the index is created for a single batch process that runs once a > year to close the fiscal year etc? > True in theory. Reports that are executing something big at the end of the year fall into three categories: 1) They touch a whole lot of the data for the year first. In this case, sequential scan is likely regardless. 2) They access data similarly to regular queries, using the same indexes. 3) They have some very specific data only they touch that is retrieved with an index. You're saying to watch out for (3); I think that's not usually the case, but that's a fair thing to warn about. Even in that case, though, it may still be worth dropping the index. Year-end processes are not usually very sensitive to whether they take a little or a long time to execute. But you will be paying to maintain the index every day while it is there. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books