cockroachdb / cockroachdb/cockroach
opt: don't invalidate polymorphic functions in the cache
Open
A-sql-routine
C-enhancement
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Currently, when we check whether a query plan with a routine call must be invalidated, we use `ResolvedFunctionDefinition.MatchOverload` ([code pointer](https://github.com/cockroachdb/cockroach/blob/3ae5fb2788441c6850573d77e04c39003927769a/pkg/sql/opt/metadata.go#L470)). This doesn't work well with polymorphic functions, since `MatchOverload` checks that the routine parameters match the argument types _exactly_, which is never true with polymorphic-typed parameters. We should relax this check for routines, to avoid unnecessarily invalidating query plans.
Jira issue: CRDB-38412
Contributor guide
Assessment
This issue has not been assessed yet.