content_image/702787.jpg
Query OK, 0 rows affected (0.00 sec) 

Both tables revert to the server’s global max_heap_table_size  value if the server restarts. 

You can also specify a MAX_ROWS  table option in CREATE TABLE  statements for MEMORY  tables to provide a hint about the number of rows you plan to store in them. This does not enable the table to grow beyond the max_heap_table_size  value, which still acts as a constraint on maximum table size. For maximum flexibility in being able to use MAX_ROWS , set max_heap_table_size  at least as high as the value to which you want each MEMORY  table to be able to grow. 

## Additional Resources 

A forum dedicated to the MEMORY  storage engine is available at https://forums.mysql.com/list.php?92. 

## 16.4 The CSV Storage Engine 

The CSV  storage engine stores data in text files using comma-separated values format. 

The CSV  storage engine is always compiled into the MySQL server. 

To examine the source for the CSV  engine, look in the storage/csv  directory of a MySQL source distribution. 

When you create a CSV  table, the server creates a plain text data file having a name that begins with the table name and has a .CSV  extension. When you store data into the table, the storage engine saves it into the data file in comma-separated values format. 

mysql> CREATE TABLE test (i INT NOT NULL, c CHAR(10) NOT NULL) ENGINE = CSV; Query OK, 0 rows affected (0.06 sec) 

mysql> INSERT INTO test VALUES(1,’record one’),(2,’record two’); Query OK, 2 rows affected (0.05 sec) Records: 2 Duplicates: 0 Warnings: 0 

mysql> SELECT * FROM test; 

<img src='content_image/702787.jpg'>

2 rows in set (0.00 sec) 

Creating a CSV  table also creates a corresponding metafile that stores the state of the table and the number of rows that exist in the table. The name of this file is the same as the name of the table with the extension CSM . 

If you examine the test.CSV  file in the database directory created by executing the preceding statements, its contents should look like this: 

"1","record one" "2","record two" 

This format can be read, and even written, by spreadsheet applications such as Microsoft Excel. 

## 16.4.1 Repairing and Checking CSV Tables 

The CSV  storage engine supports the CHECK TABLE  and REPAIR TABLE  statements to verify and, if possible, repair a damaged CSV  table. 

