rajeshdas
(Rajeshdas Rp)
December 30, 2014, 7:08am
1
Hi Expert,
Using Yii I have a 12000 records to show in a list with paging 100 records per using CActiveDataProvider . So i want only 100 records to load first time not all records(12000) to make first execution. So what should i should i do?
This bellow code load all records at a time so it takes much time to execute. Please post solution with example.
$criteria = new CDbCriteria;
$criteria->select = "t.*";
$criteria->condition = "t.deleted=0";
return new CActiveDataProvider($this,
array(
'criteria'=>$criteria,
'pagination' => array('pageSize'=>5),
)
);
Ankit_Modi
(Ankit Modi)
December 30, 2014, 7:18am
2
Hi Expert,
Using Yii I have a 12000 records to show in a list with paging 100 records per using CActiveDataProvider . So i want only 100 records to load first time not all records(12000) to make first execution. So what should i should i do?
This bellow code load all records at a time so it takes much time to execute. Please post solution with example.
$criteria = new CDbCriteria;
$criteria->select = "t.*";
$criteria->condition = "t.deleted=0";
return new CActiveDataProvider($this,
array(
'criteria'=>$criteria,
'pagination' => array('pageSize'=>5),
)
);
Please use this extension I hope it;s some help.
ronald58
(Yii)
December 30, 2014, 9:14am
3
Hi Expert,
Using Yii I have a 12000 records to show in a list with paging 100 records per using CActiveDataProvider . So i want only 100 records to load first time not all records(12000) to make first execution. So what should i should i do?
This bellow code load all records at a time so it takes much time to execute. Please post solution with example.
$criteria = new CDbCriteria;
$criteria->select = "t.*";
$criteria->condition = "t.deleted=0";
return new CActiveDataProvider($this,
array(
'criteria'=>$criteria,
'pagination' => array('pageSize'=>5),
)
);
I never experienced a performance issue with any amount of records. Does the Cactivedataprovider actually read all records? I do not think it does.
What proof do you have that the above code actually loads all records?
rajeshdas
(Rajeshdas Rp)
January 1, 2015, 9:29am
4
I never experienced a performance issue with any amount of records. Does the Cactivedataprovider actually read all records? I do not think it does.
What proof do you have that the above code actually loads all records?
Hi Ronald,
I am not sure but i am thinking so because I have a list page when this page had 50 records. It was not taking much time to load but now this page has 50,000 records it is taking much time to load.
I have also got some reference(mentioned bellow) to make fast load but could not got solution
$criteria = new CDbCriteria;
$pages = new CPagination;
$pages->pageSize = 10;
$pages->applyLimit($criteria);
$criteria->select = "t.*";
$criteria->condition = "t.deleted=0";
return new CActiveDataProvider($this,
array(
‘criteria’=>$criteria,
‘pagination’ => array(‘pageSize’=>5),
)
);
If you idea please share with me .
guaruja
(Wilnis)
January 1, 2015, 4:49pm
5
Hi Ronald,
I am not sure but i am thinking so because I have a list page when this page had 50 records. It was not taking much time to load but now this page has 50,000 records it is taking much time to load.
I have also got some reference(mentioned bellow) to make fast load but could not got solution
$criteria = new CDbCriteria;
$pages = new CPagination;
$pages->pageSize = 10;
$pages->applyLimit($criteria);
$criteria->select = "t.*";
$criteria->condition = "t.deleted=0";
return new CActiveDataProvider($this,
array(
‘criteria’=>$criteria,
‘pagination’ => array(‘pageSize’=>5),
)
);
If you idea please share with me .
check if column "deleted" has an index defined (in mysql table). If not, do so. That should/could improve performance significantly on large data sets