I recently build a web site with a small-medium profile of user access (around 150.000 pageviews/month) and sometimes, in the middle of the day I get the following error:
PDOException: SQLSTATE  Too many connections in lock_may_be_available()
The Drupal application is hosted with the MySQL on the same server, with an 2 CPUs Intel Xeon Quad Core and 8 GB of RAM.
I'm new on the Drupal world, and someone recomended me to use
db_query() to throw my queries to the database. I don't know if this is the best pratice or even if this is the root of the problem. Can anyone help me?