Re: [SQL] Bad update performance?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gunni(at)if(dot)is
Cc: pgsql-general(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Bad update performance?
Date: 1999-07-21 13:38:13
Message-ID: 1666.932564293@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

"Gunnar Ingvi Thorisson" <gunni(at)if(dot)is> writes:
> Ive a table with about 142000 rows like shown below and I want to
> set field "divis" to "unknown" by executing following update command:
> update ipacct set divis = 'unknown';
> However this seems to take hours,

Well, updating 142000 rows is going to take a little while...

Are you starting the postmaster with -o -F ? That makes for a pretty
considerable speedup in most cases (at the cost of trouble if you
have a system crash during an update).

> Does indexing the field "divis" speed up the update performance?

No, it would not help a query like that --- though if you added a clause
like "where divis = 'oldvalue'" then an index would help to find the
rows that need updated. Actually, every index you add *slows down*
updates, since all the indexes must be updated along with the table.

regards, tom lane

Browse pgsql-general by date

  From Date Subject
Next Message Leon 1999-07-21 14:57:38 Re: [GENERAL] OID IS INVALID?
Previous Message Chris Bitmead 1999-07-21 13:21:27 inheritance

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-07-21 14:59:36 Re: [HACKERS] inheritance
Previous Message Karin Probost 1999-07-21 13:27:44 I dont't receive any messages