cockroachdb / cockroachdb/cockroach
sql: implement tail-call-optimization for EXISTS subqueries
Open
A-sql-plpgsql
C-enhancement
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Subqueries within a routine are themselves implemented as lazily-executed nested routines. With #135145, we implement tail-call optimization for nested routines and subqueries that are in tail-call position. This significantly improves performance for deep recursion, like what happens for PL/pgSQL loops. We should consider extending the TCO to apply to EXISTS subqueries as well.
Jira issue: CRDB-44659
Contributor guide
Assessment
This issue has not been assessed yet.