adamsmith, on 03 January 2012 - 01:21 AM, said:
I'm sorry, I meant queries, I'm using one connection per page but there are 10-12 queries, i guessed that each query was almost like a connection to the database each time...
You can never really tell how many queries is too many because you can have a web page that looks like the following:
* A banner image on top from an ad manager script
* The site title pulled from a CMS table
* The home page content obtained from a CMS table
* A sidebar newsfeed obtained from querying a table containing blog posts
* A footer containing links obtained from another CMS table
These are 5 queries right here so if you compare that to a static HTML page that has no database interaction at all, you are looking at two very different pages right there. You can also have a 'chat' page that makes a database query every 20 seconds so there could be over a hundred database queries being made by that page (though, ideally, one shouldn't built a chat application in this manner the world is less than perfect).
If you aren't experiencing any kind of a performance problem or foresee a performance problem in future, you probably don't need to bother about the number of queries or the number of connections because the effort you put into it may not really pay off... though if you can do it right, you should, as it would be a great learning experience.