Skip to content

Give an error for a join that makes more tuples than 1 GiB holds - #448

Merged
tamnd merged 1 commit into
mainfrom
join-limit
Oct 20, 2026
Merged

tamnd merged 1 commit into
mainfrom
join-limit

Conversation

@tamnd

@tamnd tamnd commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Summary

A join that makes more tuples than 1 GiB holds now gives the error out of memory (53200). Before, the server used all the memory of the machine and stopped. The executor keeps all the tuples of a join in memory, so this limit keeps the server up until the streaming executor comes.

In the regression suite, the cross join of tenk1 with itself in groupingsets makes 100 million tuples. The server stopped there, and about 80 tests after it failed because they could not connect.

Changes

  • join and the loop of LATERAL in rupg-exec/src/scan.rs stop with an error when the join makes more tuples than join_limit lets it. The limit is 1 GiB divided by the size of a tuple. The tests use 4 MiB.
  • The error has the detail "The join makes more than N rows, and rupg keeps all the rows of a join in memory."

Known differences

PostgreSQL streams the rows of a join and gives the result. rupg gives an error for a join with more than about 27 million tuples of two relations.

Tests

A test in rupg-exec runs a cross join of 90,000 tuples, which passes, and one of 160,000 tuples, which gives 53200. fmt, clippy, the workspace tests and the checks of xtask pass on server1.

@tamnd tamnd added kind/bug It does the wrong thing. area/execution Operators, vectors, morsels, joins, aggregation and spill. labels Oct 20, 2026
@tamnd
tamnd merged commit 8c37741 into main Oct 20, 2026
5 checks passed
@tamnd
tamnd deleted the join-limit branch October 20, 2026 08:10
@tamnd tamnd mentioned this pull request Oct 20, 2026
1 of 17 tasks
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/bug It does the wrong thing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant