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.
This commit is contained in:
2026-05-17 11:35:58 +02:00
parent aeffb4e711
commit 606536fb4a

View File

@@ -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