Re: Big problem with sql update operation

Поиск
Список
Период
Сортировка
От Michal Szymanski
Тема Re: Big problem with sql update operation
Дата
Msg-id 465762B6.3080608@datera.pl
обсуждение исходный текст
Ответ на Re: Big problem with sql update operation  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Big problem with sql update operation  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-performance
Tom Lane wrote:
> Michal Szymanski <szymanskim@datera.pl> writes:
>
>> CREATE OR REPLACE FUNCTION test()
>> RETURNS void AS
>> $BODY$
>> DECLARE
>> BEGIN
>> FOR v_i IN 1..4000 LOOP
>>     UPDATE group_fin_account_tst SET
>>             credit     = v_i
>>          WHERE group_fin_account_tst_id = 1;   -- for real procedure I
>> update different rows
>>
>
> Does updating the *same* record 4000 times per transaction reflect the
> real behavior of your application?  If not, this is not a good
> benchmark.  If so, consider redesigning your app to avoid so many
> redundant updates.
>
>
Real application modifiy every time modify different row.

> (For the record, the reason you see nonlinear degradation is the
> accumulation of tentatively-dead versions of the row, each of which has
> to be rechecked by each later update.)
>
>
There is another  strange  thing. We  have two versions of our test
environment one with production DB copy and second genereated with
minimal data set and it is odd that update presented above on copy of
production is executing 170ms but on small DB it executing 6s !!!!

Michal Szymanski
http://blog.szymanskich.net

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

Предыдущее
От: "Peter T. Breuer"
Дата:
Сообщение: Re: general PG network slowness (possible cure) (repost)
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Big problem with sql update operation