程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> [MySQL友情協助]ERROR3(HY000):Errorwritingfile'/dev/s

[MySQL友情協助]ERROR3(HY000):Errorwritingfile'/dev/s

編輯:MySQL綜合教程

朋友線上DB執行SQL報錯:ERROR 3 (HY000): Error writing file '/dev/shm/MYHTwgxT' (Errcode: 28)

 

讓朋友取得dev組run 過的sql,執行explain,如下:

mysql> explainselect count(*) from ( select STG_ITEM.ITEM_ID from (selectitem_label.item_id,item_label.revision from catalog.item_label item_label innerjoin (select max(item_label.effective_date) aseffective_date,item_label.item_id from catalog.item_label inner joincatalog.item item on item.item_id=item_label.item_id anditem.revision=item_label.revision whereitem_label.EFFECTIVE_DATE>='2013-01-01 00:00:00' AND item_label.EFFECTIVE_DATE < '2014-01-14 00:00:00' and label='PROD' groupby 2) stg on item_label.effective_date=stg.effective_date anditem_label.item_id=stg.item_id and item_label.LABEL='PROD' ) STG_ITEM innerjoin catalog.attribute_set attr_set onattr_set.ATTRIBUTABLE_ENTITY_ID=STG_ITEM.ITEM_ID andattr_set.ATTRIBUTABLE_ENTITY_REVISION=STG_ITEM.REVISION left outer joincatalog.public_attribute attr onattr.ATTRIBUTE_SET_ID=attr_set.ATTRIBUTE_SET_ID whereattr_set.ATTRIBUTABLE_ENTITY_TYPE='ITEM' and attr_set.ATTRIBUTE_SET_TYPE in('LOCALE','ACTION','COUNTRY','BASE','CUSTOM','EVENT','FULFILLMENT','PUBLISHING','RESTRICTION')group by STG_ITEM.ITEM_ID, STG_ITEM.REVISION, attr_set.ATTRIBUTE_SET_ID,attr_set.ATTRIBUTABLE_ENTITY_ID, attr_set.ATTRIBUTABLE_ENTITY_TYPE,attr_set.ATTRIBUTABLE_ENTITY_REVISION, attr_set.ATTRIBUTE_SET_TYPE, attr_set.ATTRIBUTE_SET_KEY,attr.ATTRIBUTE_NAME, attr.ATTRIBUTE_VALUE ) cnt;

ERROR 3 (HY000): Error writing file '/dev/shm/MYHTwgxT' (Errcode: 28)

讓朋友馬上去檢查tmp目錄,發現磁盤tmp磁盤目錄滿了:

[xx@xx01]$ df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/Sys-root1008M 235M 723M 25% /

tmpfs 16G 16G 139M 100%/dev/shm

/dev/vda1 194M 32M 153M 18% /boot

/dev/mapper/Sys-home 4.0G 145M 3.6G 4% /home

看到此情況,我給了2個建議:

1, increase the size of/dev/shm, maybe 200G is enough.

2, this sql istoo complex to run, ptimize the sql, and run the more concise sql in theint map database, for example:

When I change the where clause “item_label.EFFECTIVE_DATE>='2013-01-01 00:00:00' ” to “item_label.EFFECTIVE_DATE>='2013-03-01 00:00:00' ”, this sql scriptcan run and get a result, as follows:

mysql> select count(*) from ( selectSTG_ITEM.ITEM_ID from (select item_label.item_id,item_label.revision fromcatalog.item_label item_label inner join (select max(item_label.effective_date)as effective_date,item_label.item_id from catalog.item_label inner joincatalog.item item on item.item_id=item_label.item_id anditem.revision=item_label.revision where item_label.EFFECTIVE_DATE>='2013-03-01 00:00:00' AND item_label.EFFECTIVE_DATE < '2014-01-14 00:00:00' andlabel='PROD' group by 2) stg on item_label.effective_date=stg.effective_dateand item_label.item_id=stg.item_id and item_label.LABEL='PROD' ) STG_ITEM innerjoin catalog.attribute_set attr_set onattr_set.ATTRIBUTABLE_ENTITY_ID=STG_ITEM.ITEM_ID andattr_set.ATTRIBUTABLE_ENTITY_REVISION=STG_ITEM.REVISION left outer joincatalog.public_attribute attr on attr.ATTRIBUTE_SET_ID=attr_set.ATTRIBUTE_SET_IDwhere attr_set.ATTRIBUTABLE_ENTITY_TYPE='ITEM' and attr_set.ATTRIBUTE_SET_TYPEin('LOCALE','ACTION','COUNTRY','BASE','CUSTOM','EVENT','FULFILLMENT','PUBLISHING','RESTRICTION')group by STG_ITEM.ITEM_ID, STG_ITEM.REVISION, attr_set.ATTRIBUTE_SET_ID,attr_set.ATTRIBUTABLE_ENTITY_ID, attr_set.ATTRIBUTABLE_ENTITY_TYPE,attr_set.ATTRIBUTABLE_ENTITY_REVISION, attr_set.ATTRIBUTE_SET_TYPE,attr_set.ATTRIBUTE_SET_KEY, attr.ATTRIBUTE_NAME, attr.ATTRIBUTE_VALUE ) cnt;

+----------+

| count(*) |

+----------+

| 58739 |

+----------+

1 row in set (7.45 sec)

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved