Bug #6746 Total Engine=Memory table size limited to about 3.5 Mb
Submitted: 22 Nov 2004 4:04 Modified: 12 Jan 2005 19:57
Reporter: Ron Savage Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.1.7 OS:Windows (Windows Server 2000)
Assigned to: CPU Architecture:Any

[22 Nov 2004 4:04] Ron Savage
Description:
Note: Under 'Category' above I put 'MyISAM Table Handler' because no pre-defined category seems appropriate.

Perl: 5.8.4
DBI 1.45
DBD::mysql 2.9003

Using Perl, and MySQL V 4.1.7, and I'm trying to copy a disk-based db into RAM, by changing all create statements to look like: 

create temporary table person (...) avg_row_length = 216 engine = memory max_rows = 16932 

where the avg_row_length value and the max_rows value come from the existing disk-based table. 

This works for the first 18 tables (out of 39), and then dies with: 
DBD::mysql::db do failed: The table 'person' is full at f:/Perl/.... 

I am populating the tables after the create, as soon as they are created.

The combined size of these tables is 4,346,526 bytes, calculated from: 
avg_row_length * max_rows 
for each table, including the person table where the error occurs. 

The default value for tmp_table_size=58M is in my.ini, and the default value for max_heap_table_size=16M. 
I tried changing max_heap_table_size=32M in my.ini but still got the error. 

When I try creating the tables in a different order, I get the same error, on a different table (10th out of 39), when the combined size of the tables created, including the table where the program fails, of 3,805,250 bytes.

This suggests to me that there is some sort of limit on the total size of all tables created and populated with Engine = Memory, of around 3.5 Mb.

I expected that the limit would be governed by tmp_table_size or perhaps max_heap_table_size, each per table, but this is not the case.

How to repeat:
Create a disk-based database, i.e. create and populate the tables.
Massage the create statements as above, to create a memory-based copy of each table in the db.
Create and populate each table in turn.
Display a running total of the approx table size, as above, ensuring the total is definitely > 5 Mb say.

Suggested fix:
Change the limit to be tmp_table_size or max_heap_table_size.
[12 Jan 2005 19:57] Jorge del Conde
I was unable to reproduce this bug.  Can you please send me a test-case that successfully reproduces this problem ?

Thanks!