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

Поиск
Список
Период
Сортировка
От fkater@googlemail.com
Тема Re: When is newly inserted data visible to another connection?
Дата
Msg-id 20100818125753.GB2581@comppasch2
обсуждение исходный текст
Ответ на Re: When is newly inserted data visible to another connection?  (Yeb Havinga <yebhavinga@gmail.com>)
Ответы Re: When is newly inserted data visible to another connection?  (Scott Ribe <scott_ribe@killerbytes.com>)
Re: When is newly inserted data visible to another connection?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Yeb Havinga:

> fkater@googlemail.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



В списке pgsql-general по дате отправления:

Предыдущее
От: Jeremy Palmer
Дата:
Сообщение: Re: Win32 Backend Cash - pre-existing shared memory block is still in use
Следующее
От: Sergey Sergeev
Дата:
Сообщение: pgsql-general@postgresql.org