Saluto
Saluto

Reputation: 81

Understanding Heroku and ClearDB max_questions resource error

I'm getting this error consistently with my Rails site on Heroku using ClearDB mySQL.

Mysql2::Error: User '123123' has exceeded the 'max_questions' resource 
(current value: 18000)

Looking at the logs, the exceptions are returning for normal ActiveRecord finds. One of the exceptions is complaining about a scope in a model concern.

ActiveRecord::StatementInvalid: Mysql2::Error: User '123123' 
has exceeded the 'max_questions' resource (current value: 36000): SET  
@@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), 
',NO_AUTO_VALUE_ON_ZERO'),  @@SESSION.sql_auto_is_null = 0, 
@@SESSION.wait_timeout = 2147483

I'm on the Punch plan. The site isn't getting much traffic at all. Around 100 visits a day. Is there something I'm not configuring correctly within Rails or Heroku to avoid this error?

Update: Moved to next plan higher and still getting these exceptions.

Upvotes: 7

Views: 5835

Answers (2)

Rbbn
Rbbn

Reputation: 725

The correct answer is from @Azhar-zafar here above.

According to the FAQ of ClearDb:

I received an error message saying that I have exceeded the ‘max_user_connections’ resource for my database. Why?

Each multi-tenant plan supports a maximum number of database connections that are allowed. This is to ensure the highest quality of service for all of the customers and databases that are on each multi-tenant cluster. If you receive this message, it means that you have reached your connection limit for the plan for which you are currently subscribed. We recommend that you upgrade your database to a larger plan to lift this restriction off of your database.

Upvotes: 0

Azhar Zafar
Azhar Zafar

Reputation: 1724

Actually, this seems to be a problem with number of queries per hour. You have max 36000 questions (queries) each hour and your application exceeded the limit. There is possibility, you have an unhandled loop or logic error in your query.

Upvotes: 4

Related Questions