codeigniter unexpected model load-Collection of common programming errors
I’m building an app where it contains 3 mysql database connections to 3 different databases. Ex. 1. Default connection => DB1 2. conn02 => DB2 3. conn03 => DB3
All this 3 connections use same username and password.
I called other 2 connections in model construct since it was not default. like:
$this->CONN2 = $this->load->database('db2', TRUE);
$this->CONN3 = $this->load->database('db3', TRUE);
Later when i called this model in controller and while rendering the view. It was taking around 7 seconds to render the view in browser. Which was long time for a view to load in browser without any db select queries.
Then i benchmarked the model and saw the result. I came to know that model was taking time. So i disabled the database connections in the model at construct and it was loading fast. I was surprised to see the result.
Can you please tell me how to solve this issue?
Here is the image of benchmark result before and after disabling the database connections in model.