Page load time issue

Hi there,

In our website we have integrated custom chat functionality.

For this we have created a separate view named "chat.php" which is included in layout as:

<?php include(‘chatview/chat.php’);?>

And in "chat.php":

I’m fetching the data from database something like this:

$chatModel = new Chat;

$online = $chatModel->onlinelist();

As such, if I keep the function "onlinelist()" empty i.e. it contains no code it takes very long time to load the page.

But if I comment the line,

//$online = $chatModel->onlinelist();

Everything works fine.

Can anybody guide me a better way.


can you paste code of onlinelist() here ?.. and please paste code in code blocks only…

Thanks for your interest.

The issue I think is not with the code.

As stated above,using:

$online = $chatModel->onlinelist();

in the view file, and

even though keeping the function as:

function onlinelist(){



creates the problem.

And if I comment the code,

it works fine.

is onlinelist a method of a real model?

does it extend ActiveRecord?

does it connect to mysql, oracle, pgsql…?

So again post your code… without it we have no hint…

If it is a real model I would check connection time to the database. It is possible that is slow.

Even if you not perform any action, if you don’t have schema cache enabled, each time yii does some queries to check the table schema.

Use the debug toolbar to see which query are executed and if any take a long time to execute.