Skip to content

sql: make InternalExecutor have the same descs.Collection as the parent #69495

@rafiss

Description

@rafiss

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

Metadata

Metadata

Assignees

Labels

A-schema-descriptorsRelating to SQL table/db descriptor handling.A-tools-activerecordA-tools-djangoA-tools-hasuraA-tools-prismaC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)C-performancePerf of queries or internals. Solution not expected to change functional behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions