Skip to content

Run a LATERAL part once when it reads no relation of the left side of its join - #446

Merged
tamnd merged 2 commits into
mainfrom
lateral-context
Oct 20, 2026
Merged

tamnd merged 2 commits into
mainfrom
lateral-context

Conversation

@tamnd

@tamnd tamnd commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Summary

A LATERAL part of a join that reads only relations outside the join now runs once for all the tuples of the left side. Before, the executor ran it again for each tuple of the left side when it read any outer relation, even one that context already holds.

Changes

  • join_item in rupg-exec/src/scan.rs checks if the right part reads a relation of the left side of its join, not any relation. A part that reads only relations outside the join runs once.
  • depends is replaced by depends_on, which takes the relations of the left side.

Known differences

None.

Tests

The tests of lateral, join, from_function, correlated, subquery and outer joins pass. fmt, clippy, the workspace tests and the checks of xtask pass on server1.

@tamnd tamnd added kind/perf It is slower or larger than the budget. area/execution Operators, vectors, morsels, joins, aggregation and spill. labels Oct 20, 2026
@tamnd
tamnd merged commit 7a59153 into main Oct 20, 2026
5 checks passed
@tamnd
tamnd deleted the lateral-context branch October 20, 2026 07:46
This was referenced Oct 20, 2026
tamnd added a commit that referenced this pull request Oct 20, 2026
* Add the changelog entries for #446 and #448

* Add temporary tables, views and sequences in the schema pg_temp_N of the session

* Keep the temporary schema first in the path of a view, a rule and a function body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/execution Operators, vectors, morsels, joins, aggregation and spill. kind/perf It is slower or larger than the budget.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant