From: | "fkater(at)googlemail(dot)com" <fkater(at)googlemail(dot)com> |
---|---|
To: | Yeb Havinga <yebhavinga(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: When is newly inserted data visible to another connection? |
Date: | 2010-08-18 12:57:53 |
Message-ID: | 20100818125753.GB2581@comppasch2 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Yeb Havinga:
> fkater(at)googlemail(dot)com 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
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2010-08-18 13:21:47 | Re: When is newly inserted data visible to another connection? |
Previous Message | Jeremy Palmer | 2010-08-18 11:35:07 | Re: Win32 Backend Cash - pre-existing shared memory block is still in use |