Re: row-attribute in EXPLAIN-output doesn't match count(*)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: row-attribute in EXPLAIN-output doesn't match count(*)
Дата
Msg-id 27509.1113521169@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: row-attribute in EXPLAIN-output doesn't match count(*)  (Greg Stark <gsstark@mit.edu>)
Ответы Re: row-attribute in EXPLAIN-output doesn't match count(*)  (Greg Stark <gsstark@mit.edu>)
Список pgsql-sql
Greg Stark <gsstark@mit.edu> writes:
> This is presumably because of the long-standing issue that Postgres takes the
> snapshot as soon as the BEGIN is issued.

No, we don't set the snapshot until the first DML query is issued.  This
is critical for serializable transactions: you have to be able to take
locks before the snapshot is frozen.

There are at least three interesting events involved:   1  BEGIN command issued   2  First lock taken (presumably as a
consequenceof another command)   3  Transaction snapshot taken (ditto; might be a different command)
 

We have to start the transaction no later than event #2 since there has
to be something to hold the lock.  But it'd be easy enough to decouple
this from BEGIN, and it'd be good enough to solve the "COMMIT;BEGIN"
problem.

Which of these three times do you think now() ought to correspond to?
I recall having argued that it should be event #3 since that corresponds
to the database snapshot you see.  100% backwards compatibility would
require setting now() at event #1, but will anyone weep if we change that?
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: row-attribute in EXPLAIN-output doesn't match count(*)
Следующее
От: Greg Stark
Дата:
Сообщение: Re: row-attribute in EXPLAIN-output doesn't match count(*)