我正在研究一个洗衣管理系统,并希望从两个包含 25000+ 行数据的表中检索带有客户名称的客户订单详细信息。我的代码工作正常,但使用联接需要很长时间才能获取结果。请帮我优化查询。谢谢 这是我的代码,它工作正常,但需要一分钟多的时间才能返回数据,并且大部分时间几乎崩溃......
$this->db->select('users.first_name,customer_order.auto_id, customer_order.invoice_no, customer_order.order_date, customer_order.order_place_from, customer_order.customer_id, customer_order.total_qty, customer_order.discount, customer_order.disc_amt, customer_order.total_paid, customer_order.total_balance, customer_order.delivery_date, customer_order.amt_paidby, customer_order.order_status, customer_order.mode_of_payment_adv, customer_order.advance_paid, customer_order.mode_of_payment_bal, customer_order.balance_paid_date');
$this->db->from('customer_order');
$this->db->join('users', 'customer_order.customer_id=users.id');
$this->db->order_by("auto_id","desc");
$data['invoiceorder'] = $this->db->get()->result();
限制记录提供了准确的时间,但我需要获取所有记录
使用代码点火器分页,限制记录,使其快速工作。 https://codeigniter.com/user_guide/libraries/pagination.html