Bug #49176 internal-temporary-tables page discusses internal *and* MEMORY tables
Submitted: 28 Nov 2009 5:42 Modified: 31 Oct 2010 18:40
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version: OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[28 Nov 2009 5:42] Roel Van de Paar
Description:
This page:
http://dev.mysql.com/doc/refman/5.1/en/internal-temporary-tables.html

States:

'A temporary table that is created initially as a MEMORY table might be converted to a MyISAM table and stored on disk if it becomes too large.'

Note that this page is talking about *internal* (automatically created by mysqld when executing a query which needs a temporary table) tables.

Some issues here:

1. The 'internal-temporary-tables.html' page discusses MEMORY tables *and* internal tables. Maybe it should only discuss *internal* tables and not MEMORY (created with CREATE TABLE ... ENGINE=MEMORY) tables?

2. Maybe there should be a similar page for MEMORY tables, specifying only those items related specifically to MEMORY tables (i.e. not discussing internal tables, nor TEMPORARY (created with CREATE TEMPORARY) tables)

There are some further documentation considerations for CREATE TEMPORARY TABLE, for which I will log a separate bug.

How to repeat:
Example shows three different table types:

1. Internal temporary table
2. MEMORY table
3a. TEMPORARY table, in MEMORY
3b. TEMPORARY table, InnoDB
3c. TEMPORARY table, MyISAM

---
mysql> FLUSH STATUS;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE TESTDISK (ID INT) ENGINE=MYISAM;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO TESTDISK VALUES (1),(2),(3),(4),(5),(8),(6),(7);
Query OK, 8 rows affected (0.00 sec)
Records: 8  Duplicates: 0  Warnings: 0

mysql> INSERT INTO TESTDISK SELECT A.ID FROM TESTDISK AS A, TESTDISK AS B, TESTDISK AS C, TESTDISK AS D;
Query OK, 4096 rows affected (0.02 sec)
Records: 4096  Duplicates: 0  Warnings: 0

mysql> SHOW STATUS LIKE '%tmp%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| Created_tmp_disk_tables | 0     |
| Created_tmp_files       | 0     |
| Created_tmp_tables      | 1     | /* Internal temporary table - to be discussed in internal-temporary-tables.html */
+-------------------------+-------+
3 rows in set (0.00 sec)

mysql> CREATE TABLE testmem (id int) ENGINE=MEMORY; /* Memory table - to be discussed in new page for memory tables */
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TEMPORARY TABLE testmem (id int) ENGINE=MEMORY; /* TEMPORARY tables - to be discussed in separate bug */
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TEMPORARY TABLE test2 (id int) ENGINE=InnoDB;
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE TEMPORARY TABLE test3 (id int) ENGINE=MyISAM;
Query OK, 0 rows affected (0.00 sec)
---
[1 Dec 2009 19:02] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

"Some issues here:

1. The 'internal-temporary-tables.html' page discusses MEMORY tables *and* internal
tables. Maybe it should only discuss *internal* tables and not MEMORY (created with
CREATE TABLE ... ENGINE=MEMORY) tables?"

In fact, it discusses only internal tables. The use of "MEMORY tables" refers to in-memory temporary tables, handled by the MEMORY storage engine. I'll clarify this.
[18 Oct 2010 19:43] Roel Van de Paar
procmon is showing that "there is no conversion to on-disk format." is not correct