litellm/litellm-proxy-extras
Carlo Alberto Ferraris 323b473835
fix: add missing indexes for top CPU-consuming queries (#23147)
* fix: add missing indexes for top CPU-consuming queries

Add indexes to eliminate full table scans on two of the top 5 queries
by CPU usage:

1. LiteLLM_VerificationToken(key_alias) — for ORDER BY key_alias ASC
   queries when listing verification tokens
2. LiteLLM_SpendLogs(user, startTime) — for WHERE user = $1 AND
   startTime BETWEEN $2 AND $3 GROUP BY queries on the spend logs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use CREATE INDEX CONCURRENTLY to avoid table locks

Both indexes are now created with CONCURRENTLY and IF NOT EXISTS
to avoid blocking writes on large production tables.
Uses -- SkipTransactionBlock for Prisma migrate compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:00:22 +05:30
..
dist build artifacts 2026-03-09 14:46:03 -07:00
litellm_proxy_extras fix: add missing indexes for top CPU-consuming queries (#23147) 2026-03-10 21:00:22 +05:30
tests
build_and_publish.md Litellm notes 181 12 (#21231) 2026-02-14 16:39:22 -08:00
LICENSE
migration_runbook.md add new migrations 2026-02-14 09:56:45 -08:00
poetry.lock bump extras 2025-11-26 11:47:29 -08:00
pyproject.toml bump: version 0.4.52 → 0.4.53 2026-03-09 14:45:41 -07:00
README.md fix: docs 2025-05-10 17:37:04 -07:00

Additional files for the proxy. Reduces the size of the main litellm package.

Currently, only stores the migration.sql files for litellm-proxy.

To install, run:

pip install litellm-proxy-extras

OR

pip install litellm[proxy] # installs litellm-proxy-extras and other proxy dependencies

To use the migrations, run:

litellm --use_prisma_migrate