Skip to content

Commit d0f82da

Browse files
zhang2014smallfish
authored andcommitted
refactor(settings): set default query memory limit to half of max and enable spilling on OOM (#19792)
1 parent e11abef commit d0f82da

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);
@@ -196,14 +197,14 @@ impl DefaultSettings {
196197
range: Some(SettingRange::Numeric(0..=u64::MAX)),
197198
}),
198199
("max_query_memory_usage", DefaultSettingValue {
199-
value: UserSettingValue::UInt64(0),
200+
value: UserSettingValue::UInt64(max_query_memory_usage),
200201
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.",
201202
mode: SettingMode::Both,
202203
scope: SettingScope::Both,
203204
range: Some(SettingRange::Numeric(0..=u64::MAX)),
204205
}),
205206
("query_out_of_memory_behavior", DefaultSettingValue {
206-
value: UserSettingValue::String(String::from("throw")),
207+
value: UserSettingValue::String(String::from("spilling")),
207208
desc: "If the query memory limit is exceeded, the system will enforce predefined actions (e.g., throw or spilling).",
208209
mode: SettingMode::Both,
209210
scope: SettingScope::Both,

0 commit comments

Comments
 (0)