我的数据库目前有超过 200,000 条记录,并且我有这个有 3 个连接的查询,我担心使用这些连接选择行可能需要太长时间并停止我的查询。有没有推荐的方法来选择这么多记录,比如一些预加载器SELECT
?我对任何事情都持开放态度。
我的查询
-- Select all records
SELECT cust.firstname, cust.lastname, cust.phone1, cust.phone2, cust.mobile1, cust.mobile2, cust.regas, cust.regpol,
cust.province, cust.city, cust.brgy, cust.unit, cust.vill, cust.condo, cust.servtype,
cust.primary, cust.override_pst, dist.name, order.created, order.branch_id 'selectedbranch', order.status,
order.delivery_date, order.date_acknowledged, order.date_dispatched, order.date_delivered, order.date_cancelled
FROM sl_customers cust
LEFT JOIN sl_orders `order` ON order.customer_id = cust.id
LEFT JOIN sl_branches branch ON order.branch_id = branch.id
LEFT JOIN sl_distributors dist ON branch.distributor_id = dist.id
ORDER BY order.id DESC
而且,是的,用于的所有列JOIN
都已编入索引。