mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(cloud-agents): index worker_jwt_hash to avoid full scans (Greptile P2)
LIT-2890 / B2's long-poll heartbeat calls find_worker_by_jwt on every request, which filters by worker_jwt_hash. Without an index that's a full table scan per heartbeat once the worker pool grows past a handful of rows. Adding the index now so it lands with the table create rather than as a follow-up migration during B2 ramp-up.
This commit is contained in:
parent
efcdbee010
commit
4479944d35
1 changed files with 5 additions and 0 deletions
|
|
@ -67,6 +67,11 @@ CREATE TABLE IF NOT EXISTS "LiteLLM_AgentWorker" (
|
|||
);
|
||||
CREATE INDEX IF NOT EXISTS "LiteLLM_AgentWorker_team_id_status_idx"
|
||||
ON "LiteLLM_AgentWorker" ("team_id", "status");
|
||||
-- Lookup by JWT digest is on the hot path — every worker long-poll
|
||||
-- heartbeat (LIT-2890 / B2) calls `find_worker_by_jwt`, which filters
|
||||
-- by this column. Without an index that's a full scan per heartbeat.
|
||||
CREATE INDEX IF NOT EXISTS "LiteLLM_AgentWorker_worker_jwt_hash_idx"
|
||||
ON "LiteLLM_AgentWorker" ("worker_jwt_hash");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "LiteLLM_AgentWorkerPairingToken" (
|
||||
"token_hash" TEXT PRIMARY KEY,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue