Home Alone
Customer
I'm testing this on our staging site. There are 300,000 users, 68M posts and 4M threads. This is the query:
Any idea why this took so long?
Code:
# Time: 210227 15:51:32
# User@Host: root[root] @ localhost []
# Thread_id: 167311 Schema: newlsa QC_hit: No
# Query_time: 4411.449023 Lock_time: 0.000070 Rows_sent: 25 Rows_examined: 309467094
# Rows_affected: 0 Bytes_sent: 60361
SET timestamp=1614459092;
SELECT `xf_dbtech_credits_transaction`.*, `xf_dbtech_credits_event_Event_1`.*, `xf_user_TargetUser_2`.*, `xf_user_SourceUser_3`.*, `xf_user_Owner_4`.*
FROM `xf_dbtech_credits_transaction` FORCE INDEX (`transaction_date`)
INNER JOIN `xf_dbtech_credits_event` AS `xf_dbtech_credits_event_Event_1` ON (`xf_dbtech_credits_event_Event_1`.`event_id` = `xf_dbtech_credits_transaction`.`event_id`)
LEFT JOIN `xf_user` AS `xf_user_TargetUser_2` ON (`xf_user_TargetUser_2`.`user_id` = `xf_dbtech_credits_transaction`.`user_id`)
LEFT JOIN `xf_user` AS `xf_user_SourceUser_3` ON (`xf_user_SourceUser_3`.`user_id` = `xf_dbtech_credits_transaction`.`source_user_id`)
LEFT JOIN `xf_user` AS `xf_user_Owner_4` ON (`xf_user_Owner_4`.`user_id` = `xf_dbtech_credits_transaction`.`owner_id`)
WHERE ((`xf_dbtech_credits_transaction`.`transaction_state` IN ('visible', 'moderated'))) AND (`xf_dbtech_credits_event_Event_1`.`active` = 1 AND `xf_dbtech_credits_event_Event_1`.`display` = 1) AND (`xf_dbtech_credits_transaction`.`currency_id` IN (1))
ORDER BY `xf_dbtech_credits_transaction`.`dateline` DESC, `xf_dbtech_credits_transaction`.`transaction_id` DESC
LIMIT 25;
Any idea why this took so long?