Skip to content

Commit f53b370

Browse files
committed
refactor(settings): set default query memory limit to half of max and enable spilling on OOM (#19792)
1 parent 042ae8a commit f53b370

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/query/settings/src/settings_default.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl DefaultSettings {
131131
Ok(Arc::clone(DEFAULT_SETTINGS.get_or_try_init(|| -> Result<Arc<DefaultSettings>> {
132132
let num_cpus = Self::num_cpus();
133133
let max_memory_usage = Self::max_memory_usage()?;
134+
let max_query_memory_usage = max_memory_usage / 2;
134135
let recluster_block_size = Self::recluster_block_size(max_memory_usage);
135136
let default_max_spill_io_requests = Self::spill_io_requests(num_cpus);
136137
let default_max_storage_io_requests = Self::storage_io_requests(num_cpus);
@@ -203,14 +204,14 @@ impl DefaultSettings {
203204
range: Some(SettingRange::Numeric(0..=u64::MAX)),
204205
}),
205206
("max_query_memory_usage", DefaultSettingValue {
206-
value: UserSettingValue::UInt64(0),
207+
value: UserSettingValue::UInt64(max_query_memory_usage),
207208
desc: "The maximum memory usage for query. If set to 0, memory usage is unlimited. This setting is the successor/replacement to the older max_memory_usage setting.",
208209
mode: SettingMode::Both,
209210
scope: SettingScope::Both,
210211
range: Some(SettingRange::Numeric(0..=u64::MAX)),
211212
}),
212213
("query_out_of_memory_behavior", DefaultSettingValue {
213-
value: UserSettingValue::String(String::from("throw")),
214+
value: UserSettingValue::String(String::from("spilling")),
214215
desc: "If the query memory limit is exceeded, the system will enforce predefined actions (e.g., throw or spilling).",
215216
mode: SettingMode::Both,
216217
scope: SettingScope::Both,

0 commit comments

Comments
 (0)