how to serialize insert followed by read(select) by different clients

From: Sandeep Gupta <gupta(dot)sandeep(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: how to serialize insert followed by read(select) by different clients
Date: 2016-08-07 03:38:43
Message-ID: CAAywg7v0o4naq_vFaKgM+=Bkkb5YWOX+x4uTVvvmH7HKydLv9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Our usage of postgres is bit unconventional. It is used for passing
data between programs (in real time).
First program, lets say the writer, (using psql) appends to a table
in the database.
Second program, the reader, (python using alchemy) reads the data.
This happens in loop, one for each day.The programs are fired in that order
and the first program always commits after it inserts new rows.

The problem is that the second program does not see the updates of the first
program consistently. If I wait the reader for 8 -- 10 secs, then for
the first day
it sees the value. For the subsequent days, the new values are not in
readers view.
Also, if the readers waits for lesser time then it does
not see the new inserts made by the writer.

The only other aspect that is unusual about the setup is that the
checkpoint segment, wal size, etc.
are all turned up to a high value (>16GB).

Any insights would be very helpful.

-sandeep

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Venkata Balaji N 2016-08-07 05:50:08 Re: Logical Decoding Failover
Previous Message Adrian Klaver 2016-08-06 19:08:20 Re: Should a DB vacuum use up a lot of space ?