Re: insert latency - Mailing list psycopg

From Robellard, Michael
Subject Re: insert latency
Date
Msg-id CA+saaMcfnA_R8TrLdJLoAYycRQ3y_p+VhaETSxpqx+WrWOTA2Q@mail.gmail.com
Whole thread Raw
In response to insert latency  (John de la Garza <john@jjdev.com>)
List psycopg
This sounds like your transaction has not committed yet.

When we started implementing celery message queuing we would run into this all the time. To fix it we wrote a special piece of logic so that the messages for the message queue would not get queued until the commit occurred. This had the added benefit of not sending the message to the queue if the transaction rolled back.

On Thu, Apr 21, 2016 at 2:58 PM, John de la Garza <john@jjdev.com> wrote:
I have two programs running.  One process does an insert.  After the
insert a message is sent to a message bus.  Then the second process
responds to the message by inserting a new row that depends on the
primary key of the first insert.

Some times I get an integrity error from the second process.  I then
wait and try again with success.

When my first insert returns what does this mean?  Does it mean that
the DB has accepted the request and will do it soon?  Or does it mean
that the DB has accepted the request and it will now be available?

It seems like the answer is the former.


--
Sent via psycopg mailing list (psycopg@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/psycopg



--
Michael Robellard
(216)288-2745

psycopg by date:

Previous
From: John de la Garza
Date:
Subject: insert latency
Next
From: Alexandre Freire da Silva Osorio
Date:
Subject: compiler errors