Skip site navigation (1) Skip section navigation (2)

Re: Table UPDATE is too slow

From: William Yu <wyu(at)talisys(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Table UPDATE is too slow
Date: 2004-08-31 19:15:22
Message-ID: ch2j5l$uap$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-performance
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.

In response to

pgsql-performance by date

Next:From: Josh BerkusDate: 2004-08-31 19:15:40
Subject: Re: Optimizing a request
Previous:From: Merlin MoncureDate: 2004-08-31 19:00:14
Subject: Re: odbc/ado problems

pgsql-general by date

Next:From: Jerry LeVanDate: 2004-08-31 19:23:10
Subject: Re: Types and SRF's
Previous:From: Tom LaneDate: 2004-08-31 19:14:52
Subject: Re: Types and SRF's

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group