Disadvantages Of Creating Many Tables In The Same Database; How Mysql Uses Internal Temporary Tables - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

example, by joining the table to itself). Each concurrent open requires an entry in the table cache. The
first open of any
Each additional use of the table takes only one file descriptor for the data file. The index file descriptor
is shared among all threads.
If you are opening a table with the
is allocated for the thread. This table object is not shared by other threads and is not closed until the
thread calls
back in the table cache (if the cache is not full). See
You can determine whether your table cache is too small by checking the
Opened_tables
started:
mysql>
SHOW GLOBAL STATUS LIKE 'Opened_tables';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Opened_tables | 2741
+---------------+-------+
If the value is very large or increases rapidly, even when you have not issued many
statements, you should increase the table cache size. See
and
Section 5.1.6, "Server Status

8.8.4. Disadvantages of Creating Many Tables in the Same Database

If you have many
are slow. If you execute
the table cache is full, because for every table that has to be opened, another must be closed. You can
reduce this overhead by increasing the number of entries permitted in the table cache.

8.8.5. How MySQL Uses Internal Temporary Tables

In some cases, the server creates internal temporary tables while processing queries. Such a table can
be held in memory and processed by the
the
MyISAM
then convert it to an on-disk table if it becomes too large. Users have no direct control over when the
server creates an internal temporary table or which storage engine the server uses to manage it.
Temporary tables can be created under conditions such as these:
• If there is an
contains columns from tables other than the first table in the join queue, a temporary table is created.
DISTINCT
• If you use the
query also contains elements (described later) that require on-disk storage.
To determine whether a query requires a temporary table, use
to see whether it says
Some conditions prevent the use of an in-memory temporary table, in which case the server uses an
on-disk table instead:
• Presence of a
• Presence of any column in a
• Presence of any column larger than 512 bytes in the
Disadvantages of Creating Many Tables in the Same Database
table takes two file descriptors: one for the data file and one for the index file.
MyISAM
HANDLER tbl_name OPEN
HANDLER tbl_name CLOSE
[530], which indicates the number of table-opening operations since the server
|
Variables".
tables in the same database directory, open, close, and create operations
MyISAM
statements on many different tables, there is a little overhead when
SELECT
storage engine. The server may create a temporary table initially as an in-memory table,
clause and a different
ORDER BY
combined with
ORDER BY
SQL_SMALL_RESULT
temporary. See
Using
or
column in the table
BLOB
TEXT
GROUP BY
or the thread terminates. When this happens, the table is put
Section 13.2.4,
Section 5.1.4, "Server System
storage engine, or stored on disk and processed by
MEMORY
clause, or if the
GROUP BY
may require a temporary table.
option, MySQL uses an in-memory temporary table, unless the
Section 8.2.1, "Optimizing Queries with
or
clause larger than 512 bytes
DISTINCT
SELECT
717
statement, a dedicated table object
"HANDLER
Syntax".
status variable
mysqld
FLUSH TABLES
ORDER BY
and check the
EXPLAIN
list, if
or
UNION
UNION ALL
Variables",
or
GROUP BY
column
Extra
EXPLAIN".
is used

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Mysql 5.0

Table of Contents