Reduce page loading time for massive data in AR

Hi all,

I have a table that contains more than 15k rows of records.

I’m pulling out the data and displaying it in a jquery datatable plugin but it took like few minutes to display. Any suggestions how to reduce the page load time?

This is how I extract data in the Controller.

$model = Property::model->with('estates','types','tenures','rooms','districts')->findAll();

$this->render('index', compact('models','pages'));

use pagination.

Hey Shawn Ang,

If you are using this kind of Queries which have a lots of model binding then You should select only those fields which are required for your view.It is obvious if you will bind lots of model and call a all query then for sure it will take a lot time.But you can reduce some execution by selecting only required fields in from all models. :)

If all fields are required to fetch from all of these models then I you should have to create a view for it and Fetch the records.And by just calling a View model you can get a Faster result then Your current Code. ;)

So, finally i will suggest you to use of Mysql View here which will surely reduce execution time of the query.

Cheers !