q2a / question2answer

Question2Answer is a free and open source platform for Q&A sites, running on PHP/MySQL.
http://www.question2answer.org/
GNU General Public License v3.0
1.63k stars 630 forks source link

Avoid joining with users table to get userid several times on user profile page #954

Closed pupi1985 closed 1 year ago

pupi1985 commented 2 years ago

Fetching the user account data early will return the userid of the profile's users. Doing this separately will avoid several lookups in the ^users table to turn the handle to a userid.

The only downside is that, for far away servers, the performance gain might be loss because of the latency of running two queries. I believe these affected users should be much less than 1%. Furthermore, if the result for them is having slower times than before, then using Q2A for those users was already a pretty bad experience.