I am looking to execute a query like this, but this sort of subquery is not currently allowed.
SELECT * FROM db.table AS OF SYSTEM TIME (SELECT statement_timestamp());
So my other option is to split the statement into two client side:
timestamp = select statement_timestamp();
SELECT * FROM db.table AS OF SYSTEM TIME timestamp;
But this leads to the possibility that the node which executed the first statement might be ahead of the node which executes the second.
What I need is a monotonically increasing cluster timestamp which could be used (such as cluster_logical_timestamp(), though this might come with a cost) or cockroachdb could support subqueries/variables?