-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: make InternalExecutor have the same descs.Collection as the parent #69495
Description
Is your feature request related to a problem? Please describe.
The internal executor uses a different descriptor Collection than the parent conn_executor. We've seen this cause performance problems since some builtins are implemented using the internal executor. If the builtin is called once per each output row in a query, then the table descriptors need to be re-fetched for each invocation of the internal executor.
@ajwerner suggests that not using the same Collection might be a correctness problem. #58356 (comment)
Describe the solution you'd like
It would be nice if the internal executor could use the same Collection as the conn_executor it's used from.
Describe alternatives you've considered
Implement builtins without using the internal executor.
Additional context
This caused severe performance problems in #57924 and #65551. We still have a backlog item for addressing other similar issues (#66173)
This was discussed in Slack: https://cockroachlabs.slack.com/archives/C0168LW5THS/p1611947857055600
Jira issue: CRDB-9622
Epic CRDB-14492