It looks like EE is doing two queries. One on the titles and another on the data, using the entries received from the title query.
So lastly, is this something I’ll need to replicate in the template using PHP? Or can this be done with one query using the query module?
0.0004 SELECT DISTINCT(t.entry_id) FROM exp_channel_titles AS t
LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id INNER JOIN exp_category_posts ON t.entry_id = exp_category_posts.entry_id
INNER JOIN exp_categories ON exp_category_posts.cat_id = exp_categories.cat_id WHERE t.entry_id !='' AND t.site_id IN ('1') AND t.entry_date < 1332158456 AND (t.expiration_date = 0 OR t.expiration_date > 1332158456) AND t.channel_id = '1' AND exp_categories.cat_id = '6' AND t.status = 'open' AND t.status != 'closed' ORDER BY t.sticky desc, t.entry_date desc, t.entry_id desc LIMIT 0, 100
0.0019 SELECT DISTINCT(t.entry_id), t.entry_id, t.channel_id, t.forum_topic_id, t.author_id, t.ip_address, t.title, t.url_title, t.status, t.dst_enabled, t.view_count_one, t.view_count_two, t.view_count_three, t.view_count_four, t.allow_comments, t.comment_expiration_date, t.sticky, t.entry_date, t.year, t.month, t.day, t.edit_date, t.expiration_date, t.recent_comment_date, t.comment_total, t.site_id as entry_site_id,
w.channel_title, w.channel_name, w.channel_url, w.comment_url, w.comment_moderate, w.channel_html_formatting, w.channel_allow_img_urls, w.channel_auto_link_urls, w.comment_system_enabled,
m.username, m.email, m.url, m.screen_name, m.location, m.occupation, m.interests, m.aol_im, m.yahoo_im, m.msn_im, m.icq, m.signature, m.sig_img_filename, m.sig_img_width, m.sig_img_height, m.avatar_filename, m.avatar_width, m.avatar_height, m.photo_filename, m.photo_width, m.photo_height, m.group_id, m.member_id, m.bday_d, m.bday_m, m.bday_y, m.bio,
md.*,
wd.*
FROM exp_channel_titles AS t
LEFT JOIN exp_channels AS w ON t.channel_id = w.channel_id
LEFT JOIN exp_channel_data AS wd ON t.entry_id = wd.entry_id
LEFT JOIN exp_members AS m ON m.member_id = t.author_id
LEFT JOIN exp_member_data AS md ON md.member_id = m.member_id WHERE t.entry_id IN (15,13,12,7,6,5) ORDER BY t.sticky desc, t.entry_date desc, t.entry_id desc