From: | Christopher Browne <cbbrowne(at)acm(dot)org> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Help with concurrent insertions. |
Date: | 2005-01-25 13:57:11 |
Message-ID: | m3wtu1txvs.fsf@knuth.knuth.cbbrowne.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Centuries ago, Nostradamus foresaw when Pradeepkumar(dot)Pyatalo(at)honeywell(dot)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!
From | Date | Subject | |
---|---|---|---|
Next Message | Glenn Davy | 2005-01-25 14:07:19 | Re: programming language for postgresql |
Previous Message | Sean Davis | 2005-01-25 11:29:21 | Re: programming language for postgresql |