Reputation: 6714
Trying to cut down on the number of queries on my site... Why would a single query run as multiple queries? Is there a way to fix this?
For example, from the following line of code (line 43)...
$model = Menu::model()->findAll();
We can see in my query log that 4 seperate queries were fired...
Or am I just reading this wrong?
Upvotes: 2
Views: 1065
Reputation: 16960
Rows 1, 2 & 4 in your screenshot above are doing database queries.
ActiveRecord in Yii does SHOW COLUMNS FROM <table>
and SHOW CREATE TABLE <table>
before the query so it knows what columns / column types the table has. In production mode you can turn on schema caching to reduce these queries:
http://www.yiiframework.com/doc/blog/1.1/en/final.deployment#enabling-schema-caching
Upvotes: 2