Hi Erik,
Well let's say that incorrectly setup JOINS were inherited with the software.
Now let's say we have fixed this SQL by doing you have suggested and will result in something like this:
SELECT %1$s.* %2$s FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'%3$sPortalUserCustomData cust ON %1$s.ResourceId = cust.ResourceId
Now you have the case with 1 million records in Users table and 1 million in PortalUserCustomData table. Now you can keep the JOIN as is or you can remove it when it's NOT needed (columns from Custom table not used in WHERE at all). Obviously, it will run faster, correct?
Now, you say it's the only SQL like this, unfortunately NO - we have it for each CategoryItems and in fact we can have it in other places. The matter of fact is that we have quite a Complex Tables structures which definitely can be optimized and re-architectured, but we need make sure we don't optimize in a way when we loose functionality.
Erik, I hope we are agree on this? If, you have a different opinion on what I have said above - you are welcome to explain why!
We are here to talk and not to fight - I am sure we all understand that.
--
Best regards,
Dmitry A.