Re: [SQL] Bad update performance?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Bad update performance?
Дата
Msg-id 1666.932564293@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bad update performance?  ("Gunnar Ingvi Thorisson" <gunni@if.is>)
Список pgsql-general
"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

В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Bitmead
Дата:
Сообщение: inheritance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] inheritance