Re: slow update but have an index

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: slow update but have an index
Дата
Msg-id 20010817201255.B20613@svana.org
обсуждение исходный текст
Ответ на slow update but have an index  (Feite Brekeveld <feite.brekeveld@osiris-it.nl>)
Список pgsql-general
On Fri, Aug 17, 2001 at 01:08:29PM +0200, Feite Brekeveld wrote:
> Now this table has about 80,000 records. I need to update 74,000 status
> fields. So I made a dump, and hacked the dump into SQL statements like:
>
> update accounting set status = 'C' where seqno = 1566385;
> ....
> and the other 74,000
>
> This is awfully slow. How come ? The index on the seqno should give
> speedy access to the record.

Well, an index speeds it up, but that times 80,000 will still take a while.
Is there any trickery or will this work?

update accounting set status = 'C';

If so, that will be much faster.

One sequential scan is faster than 80,000 index scans.

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.

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

Предыдущее
От: Micah Yoder
Дата:
Сообщение: Re: LARGE db dump/restore for upgrade question
Следующее
От: Feite Brekeveld
Дата:
Сообщение: Re: slow update but have an index