In PHP/MySQL should I open multiple database connections or share 1?

前端 未结 6 777
北恋
北恋 2021-01-17 15:50

I am wanting to hear what others think about this? Currently, I make a mysql database connection inside of a header type file that is then included in the top of every page

6条回答
  •  清酒与你
    2021-01-17 16:08

    Creating connections can be expensive (I don't have a reference for this statement as yet Edit: Aha! Here it is) so it seems as if the consensus is to use fewer connections. Using a single connection for all queries on a single page seems to be a better choice than multiple connections.

提交回复
热议问题