From 606536fb4aeb352f775ab9fb1fb1ff2a7ff64c9b Mon Sep 17 00:00:00 2001 From: rafapolo Date: Sun, 17 May 2026 11:35:58 +0200 Subject: [PATCH] Fix warm-up blocking: use LIMIT 1 instead of COUNT(*) COUNT(*) on large tables (CNPJ, RAIS) held the lock for 30s+ each, blocking all incoming queries during startup. LIMIT 1 warms the S3 file-listing cache in < 1s per table without reading all Parquet footers. --- auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth.py b/auth.py index aee541b..a2fd39b 100644 --- a/auth.py +++ b/auth.py @@ -75,7 +75,7 @@ def _warm_cache(): for t in hot_tables: try: with _lock: - _con.execute(f"SELECT COUNT(*) FROM basedosdados.{t}") + _con.execute(f"FROM basedosdados.{t} LIMIT 1") except Exception: pass