feat: add configurable memory-limit for DuckDB engine#2059
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2059 +/- ##
============================================
- Coverage 13.92% 13.92% -0.01%
Complexity 854 854
============================================
Files 604 604
Lines 17246 17251 +5
Branches 2085 2086 +1
============================================
Hits 2402 2402
- Misses 14612 14617 +5
Partials 232 232 ☔ View full report in Codecov by Sentry. |
DuckDB had no memory cap — by default it uses 80% of available RAM.
Add `memory-limit` field to `DuckDbConfig` and emit
`SET memory_limit='...'` as the first init SQL statement when configured.
The limit is applied even when the extensions directory is absent so
development environments also benefit.
Configure via package.json:
"duckdb": { "url": "jdbc:duckdb:", "memory-limit": "20GB" }
4d82989 to
3cdf7e4
Compare
ferenc-csaky
approved these changes
Jun 1, 2026
WellMafra
added a commit
that referenced
this pull request
Jun 12, 2026
Co-authored-by: Ferenc Csaky <ferenc@datasqrl.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memory-limitfield toJdbcConfig.DuckDbConfig(JSON keymemory-limit)DuckDbExtensions.buildInitSql()now emitsSET memory_limit='<value>'before loading extensions when the field is setextensionDirvalue; now logs the env var nameDUCKDB_EXTENSIONS_DIRUsage
Configure in
package.jsonserver section:Without this setting, DuckDB defaults to ~80% of available system RAM — causing OOM kills when running alongside Flink in a shared pod.
Test plan
memory-limit: "20GB"configuredSELECT current_setting('memory_limit')in DuckDB returns"20.0 GiB"