Re: Slow UPADTE, compared to INSERT

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Slow UPADTE, compared to INSERT
Дата
Msg-id 200312042023.37050.dev@archonet.com
обсуждение исходный текст
Ответ на Re: Slow UPADTE, compared to INSERT  (Ivar Zarans <iff@alcaron.ee>)
Ответы Re: Slow UPADTE, compared to INSERT  (Ivar Zarans <iff@alcaron.ee>)
Список pgsql-performance
On Thursday 04 December 2003 19:51, Ivar Zarans wrote:
>
> My second tests were done with temporary table and update query as:
> "UPDATE table1 SET Status = 'done' WHERE recid IN (SELECT recid FROM
> temptable)". It is still slower than INSERT, but more or less
> acceptable. Compared to my first tests overall processing time dropped
> from 1 hour and 20 minutes to 16 minutes.

Ah - it's probably not the update but the IN. You can rewrite it using PG's
non-standard FROM:

UPDATE t1 SET status='done' FROM t_tmp WHERE t1.rec_id = t_tmp.rec_id;

Now that doesn't explain why the update is taking so long. One fifth of a
second is extremely slow. Are you certain that the index is being used?

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: tuning questions
Следующее
От: "Matthew T. O'Connor"
Дата:
Сообщение: Re: autovacuum daemon stops doing work after about an hour