Re: Table UPDATE is too slow - Mailing list pgsql-performance

From William Yu
Subject Re: Table UPDATE is too slow
Date
Msg-id ch2j5l$uap$1@news.hub.org
Whole thread Raw
In response to Re: Table UPDATE is too slow  (Ron St-Pierre <rstpierre@syscor.com>)
List pgsql-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.

pgsql-performance by date:

Previous
From: "Gary Doades"
Date:
Subject: Re: Optimizing a request
Next
From: Jean-Max Reymond
Date:
Subject: Re: Optimizing a request