As designed Add_on List n+1 Query

MrFreeze

Member
Affected version
2.2.9
n1_b.webp


Each add-on in the add-on directory increases the query count - tested in a newly installed add-on with no add-ons installed

n1.webp
 
It's trying to find legacy XF1 placeholder add-ons for any XF2 add-ons that haven't yet been installed but have a legacy_addon_id set in addon.json. Those queries should be very fast, but each one has to do a full table scan since there's no index on legacy_addon_id. The number of queries isn't an issue, but the lack of an index isn't ideal. It's going from O(n log n) to O(n^2). For a small table, that doesn't matter too much, but it can add some time in obscure scenarios.

Even without an index, the performance impact should be negligible. If you have 100 uninstalled add-ons with legacy add-on IDs, you're only looking at ~150ms of additional query time in your case--not great, but it's temporary and only impacts admin.php. If you're experiencing slowness on admin.php, something else is to blame.
 
The look-ups are on the primary key. Given this only applies to uninstalled add-ons with a legacy add-on ID set and the queries should be quite fast, I'm not sure we'll be making any changes here.
 
Top Bottom