title: Codeigniter Load Database in Construct vs Load Database in Function
body: <p>For every project that I made, I always load database configuration in my construct function as below </p>
  
  <pre><code>public function __construct() {
      parent::__construct();
      $this-&gt;load-&gt;database();
  }
  </code></pre>
  
  <p>For some reason, I want to load different configuration for every function inside one model as below</p>
  
  <pre><code>class Something_model extends CI_Model {
  
      public function __construct() {
          parent::__construct();
      }
  
      public function getAll() {
          $this-&gt;load-&gt;database('DB1', TRUE);
          // some code to be executed
      }
  
      public function getPart() {
          $this-&gt;load-&gt;database('DB2', TRUE);
          // some code to be executed
      }
  }
  </code></pre>
  
  <p>I need some advice about those new way loading database configuration. Is there any performance problem when I load the database in every function? Or is it safe to use?</p>
  
  <p>Plus, is there any suggestion to call different database for different function inside one model?</p>