PlanetScale databases are configured with a 20 second transaction timeout. The timer starts when a transaction is opened, so even if individual queries executed within the transaction are very fast, a client can still hit the timeout if it goes 20 seconds without rolling back or committing the transaction.
beam/main> start transaction; do sleep (21); select now();
ERROR 1105 (HY000): target: beam.-.primary: vttablet: (errno 2013) due to context deadline exceeded, elapsed time: 20.000166832s, killing query ID 129454 (CallerID: planetscale-admin)
ERROR 1105 (HY000): vttablet: rpc error: code = Aborted desc = transaction 1674164964982751523: ended at 2023-01-24 16:51:52.539 UTC (unlocked closed connection) (CallerID: planetscale-admin)
The timeout is not currently configurable. If you're encountering `context deadline exceeded` errors look for long running transactions or code that could leave transactions uncommitted. Query Insights can also be helpful in uncovering slow queries.