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 DEA245E46C2 for ; Tue, 31 Aug 2004 16:33:06 -0300 (ADT) 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 34066-02 for ; Tue, 31 Aug 2004 19:32:59 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 931FA5E46CD for ; Tue, 31 Aug 2004 16:32:58 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i7VJWtLq034782 for ; Tue, 31 Aug 2004 19:32:55 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i7VJMTTW031066 for pgsql-performance@postgresql.org; Tue, 31 Aug 2004 19:22:29 GMT From: William Yu X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Table UPDATE is too slow Date: Tue, 31 Aug 2004 12:15:22 -0700 Organization: Hub.Org Networking Services Lines: 18 Message-ID: References: <4134BF36.3000504@syscor.com> <20040831181815.GB24253@uio.no> <4134C4FA.20404@syscor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en In-Reply-To: <4134C4FA.20404@syscor.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/480 X-Sequence-Number: 8116 Ron St-Pierre wrote: > Yes, I know that it's not a very good idea, however queries are allowed > against all of those columns. One option is to disable some or all of the > indexes when we update, run the update, and recreate the indexes, > however it may slow down user queries. Because there are so many indexes, > it is time consuming to recreate them after the update. Just because a query can run against any column does not mean all columns should be indexed. Take a good look at the column types and their value distribution. Let's say I have a table of addresses but every address I collect is in the 94116 zip code. That would mean indexes on city, state and zip are not only useless but could decrease performance. Also, if a search always includes a unique key (or a column with highly unique values), eliminating the other indexes would force the planner to always use that index first.