-
Notifications
You must be signed in to change notification settings - Fork 4.1k
High memory consumption from explain plan generation for statistics collection #77944
Description
This was raised by this support ticket. Turning off the sql.metrics.statement_details.plan_collection.enabled cluster settings should fix the customer's immediate issue, but this issue describes the underlying issue with our code. Further details including those private to the customer can be found in that support issue, but the gist of the underlying problem is as follows.
This is on 21.1..12. Memory consumption ballooned in the function BuildProtoTree, from generation of explain plans for very large statements such as this one from the customer.
I suspect that the larger or more likely cause of the OOM is this other issue: #77963
However, this issue is to describe that one other possible contributor to the OOM might be that very large statements use a lot of memory to generate their explain plan. We can check this by profiling the memory consumption for generating the explain plan for the customer's statement, and checking whether it is reasonable.
Jira issue: CRDB-13865
Epic CRDB-20388