title: Fatal error: Maximum execution time of 30 seconds exceeded in ...\model.php on line 183
body: <p>I'm on local machine. I only get that error when loading the page the first time after an insert|create|delete. Then it loads very fast. Then again if I modify the database, the first time(sometimes the second time) when accessing the page i get that error.
  I don't get it. </p>
  
  <p><strong>Why do i get that error only the first time when I access the site after modifying the database?</strong></p>
  
  <pre><code>$sth = $this-&gt;dbh-&gt;prepare("SELECT g.t_tree_c_parent AS gp ,h.t_tree_c_parent AS hp
                  FROM t_tree a INNER JOIN (t_data b, t_data c, t_tree d, t_data e, t_data f, t_tree g, t_tree h, t_tree i) 
                  ON a.t_tree_c_child=b.t_data_c_space
                  AND b.t_data_c_object=c.t_data_c_object
                  AND c.t_data_c_space=d.t_tree_c_child
                  AND d.t_tree_c_parent=e.t_data_c_object
                  AND e.t_data_c_space=f.t_data_c_object
                  AND f.t_data_c_space=g.t_tree_c_child
                  AND g.t_tree_c_parent=h.t_tree_c_child
                  AND e.t_data_c_space=i.t_tree_c_child
                  AND i.t_tree_c_parent=?
                  WHERE a.t_tree_c_child=?");
  $sth-&gt;execute(array($this-&gt;glob['children'], $child)); //  &lt;- LINE:183
  </code></pre>
  
  <p>I will split that query to test out. But I'm asking maybe I'm missing something.</p>
  
  <p>UPDATE asked by @jcho360:</p>
  
  <pre><code>CREATE TABLE `t_data` (
  `t_data_c_space` VARCHAR(50) NOT NULL DEFAULT '0.00000000000',
  `t_data_c_object` VARCHAR(50) NULL DEFAULT NULL,
  `t_data_c_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`t_data_c_space`)
   )
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB;
  
  CREATE TABLE `t_tree` (
  `t_tree_c_parent` VARCHAR(50) NOT NULL,
  `t_tree_c_child` VARCHAR(50) NOT NULL,
  `t_tree_c_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
  )
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB;
  </code></pre>
  
  <p>In HeidiSQL for a child(in project this query is in a recursive function):</p>
  
  <p>2.137 sec the first time after a small update in db then 0.000 sec</p>
  
  <p>I start to think that is the mysql caching, sugested by Leandro Barreto.</p>