# MySql Memory Error

**URL:** <https://www.ruby-forum.com/t/mysql-memory-error/165260>\
**Category:** Rails\
**Created:** [April 10, 2009, 11:11pm UTC](https://www.ruby-forum.com/t/mysql-memory-error/165260 "2009-04-10T23:11:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_McGilvray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8c91f0/32.png) [@Sean\_McGilvray](https://www.ruby-forum.com/u/Sean_McGilvray)\
**Post date:** [April 10, 2009, 11:11pm UTC](https://www.ruby-forum.com/t/mysql-memory-error/165260/1 "2009-04-10T23:11:36Z")

</div>

I am getting the following error when I try the following code.

controller.rb

def index  
@stats = SubscriptionPayment.stats if params[:page].blank?  
@subscriptions = Subscription.paginate(:include =\> :account, :page  
=\> params[:page], :per\_page =\> 30, :order =\> ‘accounts.name’)  
end

index.html.erb

\<% @page\_title = ‘Subscriptions’ %\>  
\<% if @stats %\>

# Revenue Summary

| Last Month | \<%= number\_to\_currency(@stats[:last\_month]) %\> |
| Last 30 Days | \<%= number\_to\_currency(@stats[:last\_30]) %\> |
| This Month | \<%= number\_to\_currency(@stats[:this\_month]) %\> |

\<% end %\>
# \<%= @page\_title %\>
 \<% @subscriptions.each do |subscription| %\> \<% end %\>

| Account | Amount | Created | Next Renewal | Status |
| --- | --- | --- | --- | --- |
| \<%= link\_to(h(subscription.account.name), [:admin, subscription]) %\> | \<%= number\_to\_currency(subscription.amount) %\> \<%= "(# {subscription.discount.name})" if subscription.discount %\> | \<%= subscription.created\_at.strftime("%d %B %Y") %\> | \<%= subscription.next\_renewal\_at.strftime("%d %B %Y") %\> | \<%= subscription.state %\> |

\<%= will\_paginate(@subscriptions) %\>

ERROR

ActiveRecord::StatementInvalid (Mysql::Error: Out of memory (Needed  
2096048 bytes):

How do I get around this or fix the current statements?

Thank you,

Sean
