简体   繁体   中英

Handling large dataset in codeigniter

I have product records above 60,000 , When I fire a query with PHPMyAdmin -> SQL it gets result instantly but when I use same with codeigniter pagination it will lag,

take too much time to load page

is their any way to handle this SH

它解决了在计数记录时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.

Using Explain Statement

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.

https://datatables.net/examples/data_sources/server_side

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM