Rails 3.2.3 mysql error "max_prepared_stmt_count"

Posted by Rob Momary on Stack Overflow See other posts from Stack Overflow or by Rob Momary
Published on 2012-12-12T21:32:22Z Indexed on 2012/12/12 23:04 UTC
Read the original article Hit count: 202

Filed under:
|

I am running a Rails 3.2.3 app deployed with apache2/passenger on a virtual host with a mysql database server. I got this error after a lot of traffic was hitting the site:

ActiveRecord::StatementInvalid (Mysql::Error: Can't create more than 
max_prepared_stmt_count statements (current value: 16382)

I'm thinking it has something to do with the amount of traffic, but if so I have to find a way around this. Anyone had this error before? I can't figure out how to stop it.

Here's what i see in mysql:

mysql> show global status like 'com_stmt%';

| Com_stmt_close | 1720319 | Com_stmt_execute | 2094137 |

| Com_stmt_fetch | 0 |

| Com_stmt_prepare | 1768924 |

| Com_stmt_reprepare | 0 |

| Com_stmt_reset | 0 |

| Com_stmt_send_long_data | 0 |

+-------------------------+---------+

I am running resque gem.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about ruby-on-rails-3.2