Cakephp routine is legend to display data in the view

Asked

Viewed 63 times

0

I’m using Cakephp 2.4.2.

I’m not able to understand the slowness to display the data. As the number of records increases in the table, the slower it gets.

The table structure is id (int(11)), name (varchar(255)), status (char(1)). The records are small.

The table has about 2500 records and passes one and a half minute the response time for all of them to be returned, and there is a pagination of 10 records per page. To get to work I have limit the return to a maximum of 250 records.

I’m new to Cakephp and I’m trying to maintain a routine I got ready for.

class ProcessosController extends AppController {
    public $name = 'Processos';
    public function beforeFilter() {
    parent::beforeFilter();
    $this->Security->unlockedActions = array('excluir','delete','salvar');
    }
    function index(){
    $processos = $this->Processo->find('all',
         array(
                'conditions' => array('Processo.status' => 1),
                'order' => array('Processo.nome ASC')
            )
        );
        $this->set('processos', $processos);
        $this->set('_serialize', array('processos'));
    }
?>
  • Already tried to select directly at the mysql prompt )?

  • It is highly recommended to use indexes as well.

1 answer

0

Does this model have relationships with other models? If so, put recursive = -1, like this:

function index(){
    $processos = $this->Processo->find('all', array(
        'conditions' => array('Processo.status' => 1),
        'order' => array('Processo.nome ASC'),
        'recursive' => -1,
    ));
    $this->set('processos', $processos);
    $this->set('_serialize', array('processos'));
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.