TrinityCore / minimanager

TrinityCore Web management tool
33 stars 38 forks source link

N+1 query issues on char_list #83

Open flashadvocate opened 1 year ago

flashadvocate commented 1 year ago

Querying for guild name accounts for at 1 additional query per character listed. Another query "to disalow lower lvl gm to view accounts of other gms" accounts for an additional query per character, making a total of 75+ queries for a list of 25. At scale, that's 300 queries on a page of 100, 600 queries on a page of 200, etc.

The cause is that these queries are being executed inside the for loop building the rows for each character. So the initial query should probably be improved / data eager loaded to include the additional data via join.

This should significantly improve the overall performance of that particular page, especially in cases where someone sets pagination limits to 100+.