pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron Mayer <ron@intervideo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bhuvan A <bhuvansql@myrealbox.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: deadlock problem in Ad serving..
Date: Mon, 20 Jan 2003 09:58:10 -0800 (PST)
Message-ID: <Pine.LNX.4.33.0301200949540.13721-100000@ron> (raw)
In-Reply-To: <3021.1043075890@sss.pgh.pa.us>


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




view thread (9+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0301200949540.13721-100000@ron>
Permalink:  ../Pine.LNX.4.33.0301200949540.13721-100000@ron/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0301200949540.13721-100000@ron

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: ron@intervideo.com, tgl@sss.pgh.pa.us, bhuvansql@myrealbox.com
  Subject: Re: deadlock problem in Ad serving..
  In-Reply-To: <Pine.LNX.4.33.0301200949540.13721-100000@ron>
  References: <3021.1043075890@sss.pgh.pa.us> <Pine.LNX.4.33.0301200949540.13721-100000@ron>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox