# User@Host: root[root] @ localhost []
# Thread_id: 12900513 Schema: live_xf QC_hit: No
# Query_time: 100.058259 Lock_time: 0.000040 Rows_sent: 20000 Rows_examined: 41121021
# Rows_affected: 0
SET timestamp=1487624154;
select
post.post_id, post.thread_id
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 1) as dark_postrating_1_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 2) as dark_postrating_2_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 4) as dark_postrating_4_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 5) as dark_postrating_5_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 6) as dark_postrating_6_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 7) as dark_postrating_7_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 8) as dark_postrating_8_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 9) as dark_postrating_9_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 10) as dark_postrating_10_count
,
pr_cache.rating_cache,
pr2.rating, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 1) as dark_postrating_1_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 2) as dark_postrating_2_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 4) as dark_postrating_4_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 5) as dark_postrating_5_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 6) as dark_postrating_6_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 7) as dark_postrating_7_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 8) as dark_postrating_8_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 9) as dark_postrating_9_count
, (select count(*) from dark_postrating pr USE INDEX (`post_id_rating`) where pr.post_id = post.post_id and pr.rating = 10) as dark_postrating_10_count
from xf_post AS post
left join dark_postrating_post_cache pr_cache ON (post.post_id = pr_cache.post_id)
left join dark_postrating pr2 on (post.post_id = pr2.post_id and pr2.user_id = 374904)
limit 41100000, 20000;