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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry LeVan 2004-08-31 19:23:10 Re: Types and SRF's
Previous Message Tom Lane 2004-08-31 19:14:52 Re: Types and SRF's

Browse pgsql-performance by date

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