Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: implicit cross joins can cause OOM errors #7572

Closed
knz opened this issue Jun 30, 2016 · 1 comment · Fixed by #9259
Closed

sql: implicit cross joins can cause OOM errors #7572

knz opened this issue Jun 30, 2016 · 1 comment · Fixed by #9259
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.

Comments

@knz
Copy link
Contributor

knz commented Jun 30, 2016

select4.test from sqllogictest causes my server to be killed by the kernel's OOM killer. It tries a cross join with 6 arguments (FROM a,b,c,d,e,f), and the join first tries to generate millions of cross-product rows in memory.

There are three issues that participate into this problem, which will need separate solutions:

  1. the JOIN makes a copy of its right-side data source in memory; if the right-side data source was itself a JOIN, we'll have the copy that JOIN made of its own right operand, plus the copy by the outer JOIN. Ideally, planNode should be extended with a Close() or Purge() interface to release allocated data structures in memory after they are not needed any more.
  2. JOINs really ought to be optimized and the filter expressions on the outer SELECT should be pushed down the JOIN operands so that the operands return fewer rows.
  3. Really we should not allow queries to allocate all the system's memory.
@knz
Copy link
Contributor Author

knz commented Jun 30, 2016

(Found while working on #3292 / #7351)

@knz knz added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. labels Oct 27, 2016
@knz knz closed this as completed in #9259 Oct 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant