Restart read required

Read this article here:

We are having these errors after performing SELECT queries, in production.
This is causing lot of delays in responding to UI clients

Our setup has, YSQL talking to postgres(yugabyte 2.4.4)

If yugabyte is a transactional database, why we receive such errors from yugabyte?

Read restart errors occur in YSQL but not in Postgres, not because of YSQL’s limitation, but due to the distributed nature of YSQL. There is a complex reasoning to it, but I will skip that and only point out that the cause lies in the fact that clocks between nodes in a distributed database can’t be in sync and this skew causes ambiguities which are bubbled up to the client as a read restart error.

Having said this, YSQL takes a best effort to internally retry the statement/ txn in case of a read restart error. If a read restart error is seen in the first statement of a txn, YSQL will restart that txn and retry the statement. The client will not see an error in this case. The retry logic tries a limited number of times (configurable via the ysql_max_read_restart_attempts gflag).

In your workload, is the SELECT within an implicit or explicit txn block? If so, is it the first statement in the txn always?