serializer_nplusone
Identify N+1 query issues in DRF serializers and get the queryset fix, tracing nested relations to provide full lookup paths for each problem.
Instructions
N+1 queries in DRF serializers, with the queryset fix for each.
find_n_plus_one answers this for templates. Most Django written today
renders JSON, and there the N+1 comes from a nested serializer field: a list
of a hundred orders runs a hundred extra queries per nested relation.
Follows nested serializers, so the lookup it suggests is the full path.
Args:
max_depth: how far to follow nested serializers.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "serializer_nplusone"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_depth | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||