I have a Yii dropdown which loads a table of cities, states, zipcodes, lat and lon. When loading the state dropdown, it takes forever. Is there a way to speed up the query to cut down on pageload time? I’ve included my view:
echo $form->dropDownList($model,'State', CHtml::listData(Zipcodes::model()->findAll(),
'State', 'State', 'State'), array('empty'=>'-- Choose State --'));
The table is 41,000 entries. Setting the $groupField in listData() didn’t seem to give any noticeable improvements.
Using CDbCriteria, I set the “GROUP BY” for the query:
I flaked out in getting back to this, but this cut down on the load significantly.