我該如何讓這個查詢運行得更快......?我如何使這個查詢運行得更快?
SELECT account_id, account_name, account_update, account_sold, account_mds, ftp_url, ftp_livestatus, number_digits, number_cw, client_name, ppc_status, user_name FROM Accounts, FTPDetails, SiteNumbers, Clients, PPC, Users WHERE Accounts.account_id = FTPDetails.ftp_accountid AND Accounts.account_id = SiteNumbers.number_accountid AND Accounts.account_client = Clients.client_id AND Accounts.account_id = PPC.ppc_accountid AND Accounts.account_designer = Users.user_id AND Accounts.account_active = 'active' AND FTPDetails.ftp_active = 'active' AND SiteNumbers.number_active = 'active' AND Clients.client_active = 'active' AND PPC.ppc_active = 'active' AND Users.user_active = 'active' ORDER BY Accounts.account_update DESC
感謝提前:)
EXPLAIN查詢結果:
我真的沒有任何外鍵設置...我試圖避免對數據庫進行修改,因爲它不得不完成修改即將進行大修。
只有主鍵是每個表的ID例如account_id,ftp_id,ppc_id ...
你有什麼指標在桌子上? –
發佈您的索引和EXPLAIN輸出供人們評估。否則,他們只會猜測。 – jishi
...和EXPLAIN計劃以及每個表的行數和索引的基數 – symcbean