If I have a pool of connections in a multi-threaded client sending out requests to the database server, can I rely on transaction or statement level timestamps to determine which data is most current?
For example, let's say I have a pair of transactions T1 and T2 which both return the same row which is updated in some way. Suppose T1 starts first. Is it possible for T2 to return stale data or complete earlier despite T1's timestamp being earlier? For instance, if T1 is slow and expensive, can it finish later and/or return data that is somehow more current than the data returned by T2?
Specific use case: Let's say we have a web server, a database server, and two different user agents connected to the web server. Let's say each user agent submits a mutation "simultaneously", and the web server wants to update the cache accordingly. How can we cache the correct result on the web server? By "correct," I mean the final result of these two mutations instead of the intermediate result.