An SQL statement raises the problem of MySQL to create temporary tables continuously to resolve: Coping to TMP table on desk

Source: Internet
Author: User
(See MySQL temp table before temporary table) first, the temporary table is visible only on the current connection, and when the connection is closed, MySQL automatically deletes the table and frees all the space.        Therefore, a temporary table with the same name can be created in a different connection, and the operation belongs to the temporary table of this connection. The syntax for creating a temporary table is similar to creating a table syntax, where the addition of the keyword temporary temporary table is used primarily to make a subset of the large data volumes and improve query efficiency . However, when a statement is written with a problem, it can cause a constant creation of temporary tables, resulting in high disk I/O utilization. I previously wrote a stored procedure with a statement that started with group by. Having, as the following analysis of the statement with explain, the statement will use a temporary table (using temprory), after executing the statement, with show GLOBAL STATUS like ' created_tmp_disk_tables '; and show GLOBAL STATUS like ' created_tmp_tables '; view, find temporary table has been increasing when removing group by. Having again with explain analysis, know, no more using temrory

Reference article: MySQL tuning three steps (slow query, explain profile) MySQL show processlist command detailed MySQL temp table

An SQL statement raises the problem of MySQL to create temporary tables continuously to resolve: Coping to TMP table on desk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.