CodeIgniter Forums
Models not sharing DB connections. Performance issues? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Models not sharing DB connections. Performance issues? (/showthread.php?tid=6048)



Models not sharing DB connections. Performance issues? - El Forum - 02-13-2008

[eluser]gon[/eluser]
Hi,

Do models share a single database connection?
I suspect they don't, as it's possible to pass each of them a different DB config.

When I used plain PHP, I would create a single connection that was used by every model.

Is there a way of doing this, and does it make sense in CI?

The reason is, obviously, performance. We expect a lot of hits on the website.
Prior to other strategies, I would like to optimize the core.

Regards.


Models not sharing DB connections. Performance issues? - El Forum - 02-13-2008

[eluser]nirbhab[/eluser]
In CI all models and controller access to same DB connection if you are extending the class by model, controller.


Models not sharing DB connections. Performance issues? - El Forum - 02-13-2008

[eluser]tonanbarbarian[/eluser]
i believe if you pass a db connection information to a model it changes all models to then use that db connection
but i could be wrong