Avoid an `OperationalError: too many SQL variables`
|Reported by:||Steffen Hoffmann||Owned by:||Steffen Hoffmann|
|Cc:||Ryan J Ollos, Jun Omae||Trac Release:|
The two-stepped approach in
tractags.model.tagged_resources doesn't work at all for large quantities of tagged resources and must be replaced to avoid an
OperationalError: too many SQL variables.
This surfaced while changing ticket tags processing for #4503. I was hit well over 10.000 tickets. Many Trac projects might not reach that number (too soon), even fewer will reach that count for other resources like wiki pages.
And issues mentioned in #4503 might actually have prevented this issue from getting known as well, because in these Trac applications TagsPlugin would have been dropped long before reaching the critical mark (resource count per tag realm). I've seen ticket view load times beyond 15 s/page with KeywordSuggestPlugin using TagsPlugin for not more than 5.000 tickets, that dropped to about 4 seconds when deactivating
get_tagged_resources (done per request) by
Still I consider it a more or less accidental find, because I've been trying to improve code, not to fix it.