Search Postgresql Archives

Re: When is newly inserted data visible to another connection?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yeb Havinga:

> fkater@xxxxxxxxxxxxxx wrote:

[...]

> > We have done a test with two connections to the database
> > on different computers.  After the first client (writer)
> > had inserted new data into a quite simple table, it told
> > another client (by TCP communication) to be ready,
> > however, this second client (reader) did not see the
> > data then immediately in the database. So we delayed the
> > reading client from 2 to 5s to have it see all data in
> > the table.

> Essential information is missing. Did the first client
> COMMIT before toggling client 2?

Yes, of course, the commit was done before toggling client
2. I would like to mention that the table itself is simple
however contains a bytea column and some of the inserted
rows contain some MBs of binary data which usually take a
while.  But, yes, we trigger client 2 only *after* the
commit was done and returned successfully (using v8.2.4 on
win32 via libpq).

> Also you might find the information from
> http://developer.postgresql.org/pgdocs/postgres/transaction-iso.html
> interesting, since that specifies how to control behaviour
> of concurrent transactions looking at each others data.

Thank you for the interesting link. I think, though, that
this does not address the question why there is a delay
between the point in time A that client 1 has successfully
commited and the point in time B when client 2 can see all
new rows! Even in pure serialization it should be possible
that client 2 can immediately start reading *after* client 1
has completely commited, shouldn't it? FYI: We are using the
default setup for transaction isolation.


> > Secondly: If yes, is there a way to determine when newly
> > inserted data is visible to other clients?
> >   
> Not before it is committed. To which clients the just
> committed data is visible depends on the transaction
> isolation level (see link above).

Hm, I do not get it -- AFAIK the article you mentioned deals
with the question what a concurrent transaction can see from
another one which is pending/not committed. But this is not
the case here. The first transaction is commited before.

To sum up our question:

If client 1 has commited some rows, when is the moment that
client 2 can see/read all that data? Do we have to consider
a gap and if yes how to determine it?

Thank You!
 Felix



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux