You should put this in your my.cnf:
long_query_time=1
log-slow-query=/var/log/mysql/mysql-slow.log
1 second is the lowest setting for now, but that's good enough to find the slowest queries.
If the log says that to find 1 entry it scanned 50000 entries, that means something is wrong with the query.
You can analyze the slow query:
EXPLAIN SELECT .... WHERE user.avatarid=avatar.userid ...
If it says ALL entries, that's bad.
For example, in the former statement there must be indexes ON
user.avatarid
avatar.userid
|