I want to know why there is retry ntx(RETRY_SERIALIZABLE) error

Thanks for your question! Do you have another transaction running concurrently that also accesses table a?

CockroachDB uses SERIALIZABLE transaction isolation, which means that it must be able to find a serializable ordering of all transactions. In other words, even if transactions are running in parallel, the end result is the same as if they had executed one at a time.

For more information, consult this page: https://www.cockroachlabs.com/docs/v20.2/transaction-retry-error-reference.html Let me know if you have additional questions.