Re: performance on insert/update

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: performance on insert/update
Дата
Msg-id 1764.967560934@sss.pgh.pa.us
обсуждение исходный текст
Ответ на performance on insert/update  (Jerome Raupach <jraupach@intelcom.fr>)
Список pgsql-sql
Jerome Raupach <jraupach@intelcom.fr> writes:
> I have a big problem of performance, please help me.

You could code the update so it only evaluates the view once,
rather than twice per table2 row as you now have it:

UPDATE table2 SETnb=table2.nb+view1.nb,time=table2.time+view1.time
FROM view1
WHERE view1.f1=table2.f1 and view1.date=table2.date;

Subselects are nice, but they're not cheap.  Joins are faster.

The view itself also seems to be pretty inefficiently coded,
although I'm not sure you can do much better given that GROUP BY
doesn't really work in views right now.  Hopefully by 7.2 there
will be a better way to do the view.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: How do you detect row version changes in PostgreSQL?
Следующее
От: Webb Sprague
Дата:
Сообщение: Re: Re: Argument variables for select