From 6bac1c2e344d2853a653163faa94dd3771ee7d4f Mon Sep 17 00:00:00 2001 From: rafapolo Date: Sun, 17 May 2026 11:24:16 +0200 Subject: [PATCH] Tune DuckDB connection settings for better S3 query performance Add http_keep_alive, http_retries, preserve_insertion_order to _init_db(). Bump memory_limit from 4GB to 6GB to match available server RAM. --- auth.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/auth.py b/auth.py index 391700f..97650fc 100644 --- a/auth.py +++ b/auth.py @@ -23,7 +23,10 @@ def _init_db(): SET s3_url_style='path'; SET enable_object_cache=true; SET threads=4; - SET memory_limit='4GB'; + SET memory_limit='6GB'; + SET preserve_insertion_order=false; + SET http_keep_alive=true; + SET http_retries=3; """) _con.execute("ATTACH '/app/data/basedosdados.duckdb' AS basedosdados (READ_ONLY)")