If I paginate from a temporary table, when do I drop the table? Does/can the table go into memory once it hits the front end so that the table can be dropped immediately? Or does it need to “hang around” until the user stops leafing through the pages?
Share
From the MySQL 5.1 Reference Manual – 13.1.17 CREATE TABLE Syntax:
A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.)
“If I paginate from a temporary table, when do I drop the table?”
MySQL does it as soon as the connection is closed.
From the MySQL 5.1 Reference Manual – 14.4. The MEMORY (HEAP) Storage Engine:
The MEMORY storage engine creates tables with contents that are stored in memory. Formerly, these were known as HEAP tables. MEMORY is the preferred term, although HEAP remains supported for backward compatibility.
The MEMORY storage engine associates each table with one disk file. The file name begins with the table name and has an extension of .frm to indicate that it stores the table definition.
Example:
Does/can the table go into memory once it hits the front end so that
the table can be dropped immediately?
Yes, the table with the search results can be placed into memory, thus providing faster access time.
You can read more: MySQL Documentation: MySQL Reference Manuals