Re: Help with concurrent insertions.

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: Help with concurrent insertions.
Дата
Msg-id m3wtu1txvs.fsf@knuth.knuth.cbbrowne.com
обсуждение исходный текст
Ответ на Help with concurrent insertions.  ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>)
Список pgsql-novice
Centuries ago, Nostradamus foresaw when Pradeepkumar.Pyatalo@honeywell.com ("Pradeepkumar, Pyatalo (IE10)") would
write:
> Could anyone help me out with this.

May I suggest doing a slightly different "interlock"?

mobile% echo $$
65425

--> At the start of your update process, determine your process's
    PID.  Let's suppose it's 65425.

--> First query:
     update ebihistory set flag = 65425 where flag = 0

    That claims all records with flag = 0 for the local process.

--> Then, to process them...

    select [whatever] from pointtable p, ebihistory e
    where p.pointid = e.pointnumber and e.flag = 65425;

--> Then, once they're done

    update ebihistory set flag = 1 where flag = 65425

If there is some possibility of processes failing, you might want to
make sure that there's no update process running, and then run the
query:

   update ebihistory set flag = 0 where flag > 1;

That draws back to 0 [unclaimed] any entries that haven't had
processing finished yet.
--
let name="cbbrowne" and tld="gmail.com" in name ^ "@" ^ tld;;
http://cbbrowne.com/info/internet.html
I am not a Church numeral!
I am a free variable!

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

Предыдущее
От: Márcio Vinícius
Дата:
Сообщение: BatchMove with PostgreSQL
Следующее
От: Klaus
Дата:
Сообщение: How to create Geo Types from numeric?