I recently built a website 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[08004] [1040] Too many connections in lock_may_be_available()
The Drupal application is hosted with the MySQL, same server, with 2 CPUs Intel Xeon Quad Core and 8 GB of RAM.
I'm new to the Drupal world, and someone recommended me to use db_query()
to throw my queries to the database. I don't know if this is the best practice, or even if this is the root of the problem. Can anyone help me?