On Mon, 20 Jan 2003, Tom Lane wrote:
>
> Bhuvan A <bhuvansql@myrealbox.com> writes:
> >> Error:...deadlock detected...
> > ... You can overcome this by locking the table in share row
> > exclusive mode also...
>
> ...use shorter transactions (one per page, not one per several pages).
Hmm... with his query:
"update banner_stats set imp=imp+1 where uniqid=4330"
Is it true that the problem happens when updates are done
in a different order by two transactions like this:
trans.1: "update banner_stats set imp=imp+1 where uniqid=4330"
trans.2: "update banner_stats set imp=imp+1 where uniqid=10"
trans.1: "update banner_stats set imp=imp+1 where uniqid=10"
trans.2: "update banner_stats set imp=imp+1 where uniqid=4330"
If so, then could the problem be avoided if in his application
logic he always did the updates in the same order? ... I.e. Make
sure the each transaction does the updates in the same order by
sorting his updates based on uniqid in the client?
Ron