PR #158527 added a new cluster setting and logic to prevent sql stats from having unbounded memory growth when certain workload types are running. This implementation only accounts for statements executed and recorded in the conn executor, but not other areas such as statements stats are recorded, such as in UDFs and SPs. It may be possible for UDFs / SPs to execute millions of statements, causing similar memory issues that were fixed by the previously mentioned PR.
While this will likely have other unknown impacts on the SQL server, we should ensure that SQL Stats can handle this case.
Jira issue: CRDB-58044