• <small id='HerYc'></small><noframes id='HerYc'>

    <i id='HerYc'><tr id='HerYc'><dt id='HerYc'><q id='HerYc'><span id='HerYc'><b id='HerYc'><form id='HerYc'><ins id='HerYc'></ins><ul id='HerYc'></ul><sub id='HerYc'></sub></form><legend id='HerYc'></legend><bdo id='HerYc'><pre id='HerYc'><center id='HerYc'></center></pre></bdo></b><th id='HerYc'></th></span></q></dt></tr></i><div id='HerYc'><tfoot id='HerYc'></tfoot><dl id='HerYc'><fieldset id='HerYc'></fieldset></dl></div>

      <tfoot id='HerYc'></tfoot><legend id='HerYc'><style id='HerYc'><dir id='HerYc'><q id='HerYc'></q></dir></style></legend>
        • <bdo id='HerYc'></bdo><ul id='HerYc'></ul>
      1. Mysql目录里的ibtmp1文件过大造成磁盘占满的解决办法

        ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
        <i id='oosZ8'><tr id='oosZ8'><dt id='oosZ8'><q id='oosZ8'><span id='oosZ8'><b id='oosZ8'><form id='oosZ8'><ins id='oosZ8'></ins><ul id='oosZ8'></ul><sub id='oosZ8'></sub></form><legend id='oosZ8'></legend><bdo id='oosZ8'><pre id='oosZ8'><center id='oosZ8'></center></pre></bdo></b><th id='oosZ8'></th></span></q></dt></tr></i><div id='oosZ8'><tfoot id='oosZ8'></tfoot><dl id='oosZ8'><fieldset id='oosZ8'></fieldset></dl></div>
      2. <tfoot id='oosZ8'></tfoot>

        <small id='oosZ8'></small><noframes id='oosZ8'>

                <tbody id='oosZ8'></tbody>
              <legend id='oosZ8'><style id='oosZ8'><dir id='oosZ8'><q id='oosZ8'></q></dir></style></legend>

              • <bdo id='oosZ8'></bdo><ul id='oosZ8'></ul>

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 
                  为了避免ibtmp1文件无止境的暴涨导致再次出现此情况,可以修改参数,限制其文件最大尺寸。如果文件大小达到上限时,需要生成临时表的SQL无法被执行(一般这种SQL效率也比较低,可借此机会进行优化) 

                  解决办法

                  1、修改 my.cnf 配置文件:

                  innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G
                  # 12M代表文件初始大小,5G代表最大size 
                  2、重启mysql服务,重启后查看是否生效
                  systemctl restart mysqld
                  可能导致ibtmp1文件会暴涨的情况:

                  ​​​​​​​1.用到临时表,当EXPLAIN 查看执行计划结果的 Extra 列中,如果包含 Using Temporary就表示会用到临时表。
                   
                  2.GROUP BY无索引字段或GROUP BY + ORDER BY的子句字段不一样时。
                   
                  3.order by与distinct共用,其中distinct与order by里的字段不一致(主键字段除外)。
                   
                  4.insert into table1 select xxx from table2。
                   
                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)
                  MySQL cumulative sum grouped by date(按日期分组的 MySQL 累计总和)

                    <legend id='n72ON'><style id='n72ON'><dir id='n72ON'><q id='n72ON'></q></dir></style></legend>
                      <tbody id='n72ON'></tbody>

                      <small id='n72ON'></small><noframes id='n72ON'>

                      <i id='n72ON'><tr id='n72ON'><dt id='n72ON'><q id='n72ON'><span id='n72ON'><b id='n72ON'><form id='n72ON'><ins id='n72ON'></ins><ul id='n72ON'></ul><sub id='n72ON'></sub></form><legend id='n72ON'></legend><bdo id='n72ON'><pre id='n72ON'><center id='n72ON'></center></pre></bdo></b><th id='n72ON'></th></span></q></dt></tr></i><div id='n72ON'><tfoot id='n72ON'></tfoot><dl id='n72ON'><fieldset id='n72ON'></fieldset></dl></div>

                            <bdo id='n72ON'></bdo><ul id='n72ON'></ul>
                            <tfoot id='n72ON'></tfoot>