它解决了在计数记录时num_rows()
需要20秒 ,而$this->db->select('COUNT(*) as count')
与get()-> row()只需0.63秒
Generally the speed of your queries are based on indexes and references. I would suggest that you check that first.
You can use the 'Explain' statement to get a better idea as to how to optimize your query. Here is more information directly from the MySQL site.
I would also highly recommend turning on 'profiler' for CI to determine where the bottle neck actually is.
$this->output->enable_profiler(TRUE);
Thirdly if I am not able to get any additional information back based on your profiler I would alternately recommend you using jQuery datatables in conjunction with CI, its server side processing can handle millions of rows within a short time. It will only load the page that is currently active to make things a lot more simpler and easier on the users end.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.