Re: [JDBC] Is what I want possible and if so how?

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: [JDBC] Is what I want possible and if so how?
Дата
Msg-id 1153500394.5683.304.camel@coppola.muc.ecircle.de
обсуждение исходный текст
Ответ на Re: [JDBC] Is what I want possible and if so how?  (Jochem van Dieten <jochemd@oli.tudelft.nl>)
Список pgsql-general
Jochem,

> For a small number of processes and a large difference in time
> between the 'loookup' speed and the 'work' I have used a two-step
> process where you first get a batch of records and then try them
> all in rapid succession. In pseudocode:
>
> SELECT *
> FROM table
> WHERE condition
> LIMIT number_of_queue_processes + 1;
>
> LOOP;
>    BEGIN;
>      SELECT *
>      FROM table
>      WHERE condition AND pk = xxx
>      LIMIT 1 FOR UPDATE NOWAIT;
>
>      do something;
>    COMMIT;
> END;
>

I decided to use the same schema here. The only improvement I can see to
it is to shuffle the batch in random order... that way the competing
processors get a higher chance to avoid collision. I have to see if this
really works out well once I get the chance to deploy it...

Thanks,
Csaba.



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

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: Impact of vacuum full...
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Impact of vacuum full...