Обсуждение: Regarding Postgresql Transaction isolation

Поиск
Список
Период
Сортировка

Regarding Postgresql Transaction isolation

От
Ajay P S
Дата:
Hi,

I understand that in READ COMMITTED isolation level, SELECT queries
reads a snapshot of the database as of the instant the query begins.
And also a concurrent transaction(uncommitted) writing to the same
table won't block the readers.
However, I see that in the heap_update(heapam.c) function there is a
brief interval(Lock and unlock the buffer) where a writer may block
readers if the writer is updating the same row which readers are
reading.
Could anyone please help me with the below query?

1) Is my understanding correct? In so, Is it not against the
statements "readers does not block writers and writers does not block
readers"

Best,
Ajay



Re: Regarding Postgresql Transaction isolation

От
Tom Lane
Дата:
Ajay P S <ajayps547@gmail.com> writes:
> However, I see that in the heap_update(heapam.c) function there is a
> brief interval(Lock and unlock the buffer) where a writer may block
> readers if the writer is updating the same row which readers are
> reading.
> Could anyone please help me with the below query?

> 1) Is my understanding correct? In so, Is it not against the
> statements "readers does not block writers and writers does not block
> readers"

You should probably read that as "there are no macroscopic block
conditions between readers and writers".  If you want to quibble
about whether a transient buffer lock violates the statement,
there are doubtless hundreds of other places where there's some
sort of short-term blockage.  A trivial example is that just
finding the buffer in the first place can be transiently blocked
by spinlock or LWLock exclusion on the buffer lookup data structures.

            regards, tom lane