articlesUsingImages and uniqueUsedImages are being fetched from the same table(globalimagelinks ) to it can be merged into a single query.
sql = 'select count(*) as articlesUsingImages, count(distinct gil_to) as uniqueUsedImages from globalimagelinks where gil_to in (select log_title from logging_userindex where log_type="upload" and log_user=(select user_id from user where user_name="%s"));' % username
It would require merging the two methods into a single function but would at least save 1 DB call.