Shawn Ang
Shawn Ang

Reputation: 538

Yii Framework, reduce page loading time due to massive data in sql table

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'));

Upvotes: 1

Views: 1635

Answers (1)

Alfredo Castaneda Garcia
Alfredo Castaneda Garcia

Reputation: 1659

Use pagination and just omit "with", that way the records will be eagerly loaded, so only those needed to display would actually be in cache. Give it a try and you'll see immediate difference.

Upvotes: 1

Related Questions