From: Tom Lane <tgl@sss.pgh.pa.us>
To: gunni@if.is
Cc: pgsql-general@postgreSQL.org
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Bad update performance?
Date: Wed, 21 Jul 1999 09:38:13 -0400
Message-ID: <1666.932564293@sss.pgh.pa.us> (raw)
In-Reply-To: <000001bed304$78193380$65dea8c0@gunni.gi.hf.is>
"Gunnar Ingvi Thorisson" <gunni@if.is> writes:
> I´ve 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, gunni@if.is, pgsql-general@postgreSQL.org
Subject: Re: [SQL] Bad update performance?
In-Reply-To: <1666.932564293@sss.pgh.pa.us>
References: <000001bed304$78193380$65dea8c0@gunni.gi.hf.is> <1666.932564293@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox