Why is this INNER JOIN/ORDER BY mysql query so slow?
问题 I have very big database of customers. This query was ok before I added ORDER BY . How can I optimize my query speed? $sql = "SELECT * FROM customers LEFT JOIN ids ON customer_ids.customer_id = customers.customer_id AND ids.type = '10' ORDER BY customers.name LIMIT 10"; ids.type and customers.name are my indexes Explain query id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE customers ALL NULL NULL NULL NULL 955 Using temporary; Using filesort 1 SIMPLE ids ALL type