From 3160cdd913a075047b4c5d3d475a3912c26e2da7 Mon Sep 17 00:00:00 2001 From: Polina Kazakova Date: Tue, 17 Oct 2023 18:22:14 +0200 Subject: [PATCH] Limit max RAM that duckdb can use (#1991) manually set limit to ram that duckdb can use --- .../worker/job_runners/split/descriptive_statistics.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/worker/src/worker/job_runners/split/descriptive_statistics.py b/services/worker/src/worker/job_runners/split/descriptive_statistics.py index 61529ed95e..7489e75fea 100644 --- a/services/worker/src/worker/job_runners/split/descriptive_statistics.py +++ b/services/worker/src/worker/job_runners/split/descriptive_statistics.py @@ -481,7 +481,13 @@ def compute_descriptive_statistics_response( logging.info(f"Original number of threads={n_threads}") con.sql("SET threads TO 8;") n_threads = con.sql("SELECT current_setting('threads')").fetchall()[0][0] - logging.info(f"Number of threads={n_threads}") + logging.info(f"Current number of threads={n_threads}") + + max_memory = con.sql("SELECT current_setting('max_memory');").fetchall()[0][0] + logging.info(f"Original {max_memory=}") + con.sql("SET max_memory TO '28gb';") + max_memory = con.sql("SELECT current_setting('max_memory');").fetchall()[0][0] + logging.info(f"Current {max_memory=}") logging.info("Loading data into in-memory table. ") create_table_command = CREATE_TABLE_COMMAND.format(