Steve Dodd
2014-09-24 17:52:17 UTC
Say we have two transactions run sequentially: T1 writes some data, and T2 reads the written data. There is a non-zero time delay between the apparent T1 commit, and the subsequent T2 query.
Is there any guarantee that the data written in T1 will be visible to the query in T2?
We have a situation in our system where it would appear that the answer is NO.
Based on my limited understanding of PostgreSQL internals, although T1 has apparently been committed (from the clientâs perspective), that doesnât necessarily mean that it has been completed inside the database. It seems that a commit only means that the transaction has been added to the WAL, but it doesnât mean the transaction results are available to subsequent transactions. At some later date, the database completes T1, and then makes it visible to future transactions. Only after that point would the data be visible to T2. So if T2 runs too soon after T1, T1âs writes wonât be visible to T1.
Can someone clarify this for me?
Thanks so much,
Steve
--
This e-mail message is intended for the named recipient(s) above, and may
contain information that is privileged, confidential and/or exempt from
disclosure under applicable law. If you have received this message in
error, or are not the named recipient(s), please do not read the content.
Instead, immediately notify the sender and delete this e-mail message. Any
unauthorized use, disclosure or distribution is strictly prohibited.
Quantify Labs Inc and the sender assume no responsibility for any errors,
omissions, or readers' misinterpretations and/ or understanding of the
content or transmission of this email.
Is there any guarantee that the data written in T1 will be visible to the query in T2?
We have a situation in our system where it would appear that the answer is NO.
Based on my limited understanding of PostgreSQL internals, although T1 has apparently been committed (from the clientâs perspective), that doesnât necessarily mean that it has been completed inside the database. It seems that a commit only means that the transaction has been added to the WAL, but it doesnât mean the transaction results are available to subsequent transactions. At some later date, the database completes T1, and then makes it visible to future transactions. Only after that point would the data be visible to T2. So if T2 runs too soon after T1, T1âs writes wonât be visible to T1.
Can someone clarify this for me?
Thanks so much,
Steve
--
This e-mail message is intended for the named recipient(s) above, and may
contain information that is privileged, confidential and/or exempt from
disclosure under applicable law. If you have received this message in
error, or are not the named recipient(s), please do not read the content.
Instead, immediately notify the sender and delete this e-mail message. Any
unauthorized use, disclosure or distribution is strictly prohibited.
Quantify Labs Inc and the sender assume no responsibility for any errors,
omissions, or readers' misinterpretations and/ or understanding of the
content or transmission of this email.