Re: insert latency

From: "Robellard, Michael" <mike(at)robellard(dot)com>
To: John de la Garza <john(at)jjdev(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: insert latency
Date: 2016-04-21 19:03:29
Message-ID: CA+saaMcfnA_R8TrLdJLoAYycRQ3y_p+VhaETSxpqx+WrWOTA2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)jjdev(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/psycopg
>

--
Michael Robellard
(216)288-2745

In response to

Browse psycopg by date

  From Date Subject
Next Message Alexandre Freire da Silva Osorio 2016-04-25 14:54:18 compiler errors
Previous Message John de la Garza 2016-04-21 18:58:45 insert latency