docs: add DB query performance guidelines to CLAUDE.md#23196
Merged
RheagalFire merged 1 commit intoBerriAI:litellm_oss_staging_03_10_2026from Mar 10, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis documentation-only PR extends the Key additions:
One minor gap remains: Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| CLAUDE.md | Adds 7 database query performance guidelines to the "Proxy database access" section, covering N+1 queries, batch writes, server-side aggregation, result-set bounding, column selection, index coverage, and schema sync. Guidelines are largely accurate after multiple review rounds; one minor omission: create_many(skip_duplicates=True) silent-skip behavior is not documented alongside the analogous update_many/delete_many no-op caveat. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[New DB Operation] --> B{Multiple rows\nor loop?}
B -->|Loop detected| C[Batch: find_many with 'in'\nor create_many/update_many/delete_many]
B -->|Single op| D{Need aggregation\nor dedup?}
C --> E{Return value\nneeded?}
E -->|Yes| F[update / delete\nRaises RecordNotFoundError]
E -->|No| G[update_many / delete_many\nSilently no-ops on missing rows]
D -->|Yes| H[Push to DB: group_by,\naggregate in SQL\nNot find_many with distinct]
D -->|No| I{Wide table?}
I -->|Yes| J[Add select to limit columns\nNote: returns partial object]
I -->|No| K{Large result set?}
K -->|>~10 MB| L[Paginate with cursor+take\nor skip+take with explicit order]
K -->|Small / bounded| M[find_many / find_unique directly]
L --> N{Prefer cursor\npagination}
N -->|cursor+take| O[Cursor must be unique field]
N -->|skip+take| P[skip is O skip-value — avoid for large offsets]
Last reviewed commit: 9d2b011
676a4bd to
cdeff82
Compare
cdeff82 to
7963da5
Compare
7963da5 to
3496007
Compare
3496007 to
8eb8b8d
Compare
CAFxX
commented
Mar 10, 2026
4259acf to
217a647
Compare
217a647 to
5d5ee9d
Compare
1f7d184 to
648e8ec
Compare
648e8ec to
12fd00f
Compare
12fd00f to
1c117fd
Compare
1c117fd to
1141b0b
Compare
1141b0b to
4a7497b
Compare
30afe44 to
b82c680
Compare
1 task
b82c680 to
fdedcb4
Compare
fdedcb4 to
58a8531
Compare
Extend the "Proxy database access" section with guidelines to prevent common DB performance issues, tailored to actual Prisma usage patterns in the litellm codebase: N+1 queries, client-side processing, batching writes, bounding result sets, select on wide tables, index coverage, and schema file sync. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58a8531 to
9d2b011
Compare
2b093aa
into
BerriAI:litellm_oss_staging_03_10_2026
27 of 38 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
group_byoverdistinct), bounding large result sets with cursor-based pagination, usingselecton wide tables, batching writes with deadlock-safe ordering, preferringupdate_many/delete_manywhen return values aren't needed, index coverage considerations, and schema file sync requirementsdistinctcausing full table scan on 3M+ rowsTest plan
🤖 Generated with Claude Code