Re: "Sending Data" is taking time post migration from 5.1 to 5.6
Hi peter
We have tried with different Default_tmp_storage_engine like MYISAM, innodb and MEMORY while creating the table but we didn't found any improvement in performance.
we are also updated query cache settings.
In Show Engine InnoDB Status, We didn't observe any lock on the tables.
Show create temporary table result:
===================================
'CREATE TEMPORARY TABLE `BCT_VA_RES1_TMP` ( `Status` char(1) DEFAULT NULL, `Level` char(1) DEFAULT NULL, `SEQ` smallint(5) unsigned DEFAULT NULL, `C_QTY` double DEFAULT NULL, `QTY` double DEFAULT NULL, `SDATE` date DEFAULT NULL, `SDATE_NAME` varchar(10) DEFAULT NULL, `BLDATE` date DEFAULT NULL, `BLDATE_NAME` varchar(10) DEFAULT NULL, `BL` enum(\'N\',\'Y\') DEFAULT NULL, `VENDOR_ID` varchar(10) DEFAULT NULL, `OU_CODE` smallint(6) DEFAULT NULL, `SUB_SYSTEM_ID` smallint(6) DEFAULT NULL, `MATCH_BL` char(1) DEFAULT \'0\', `HEAD_PRODREV_ID` varchar(10) DEFAULT NULL, `HEAD_ProductNo_Rst` varchar(50) NOT NULL, `HEAD_PRODNO` varchar(50) DEFAULT NULL, `HEAD_RSTATE` varchar(16) DEFAULT NULL, `DESCRIPTION` varchar(50) DEFAULT NULL, `PRODREV_ID` varchar(10) DEFAULT NULL, `ProductNo_Rst` varchar(50) NOT NULL, `PRODNO` varchar(50) DEFAULT NULL, `RSTATE` varchar(16) DEFAULT NULL, `RATE_SPAN` varchar(20) DEFAULT NULL, `VOLUME` double DEFAULT NULL, `BLVOLUME` double DEFAULT NULL, `SCUR` char(3) DEFAULT NULL, `TCUR` char(3) DEFAULT NULL, `BOM_MAT` double DEFAULT NULL, `COA_MAT` double DEFAULT NULL, `INT_COA_MAT` double DEFAULT NULL, `COA_RATE` double DEFAULT NULL, `INT_COA_RATE` double DEFAULT NULL, `COA` double DEFAULT NULL, `INT_COA` double DEFAULT NULL, `INB_FRT_DY` double DEFAULT NULL, `INT_MAT_TRANF` double DEFAULT NULL, `TOT_MAT` double DEFAULT NULL, `ITO_TARGET` double DEFAULT NULL, `LIBOR_RATE` double DEFAULT NULL, `COC_RATE` double DEFAULT NULL, `COC` double DEFAULT NULL, `SMT_CHIP_RATE` double DEFAULT NULL, `SMT_CHIP_NO` double DEFAULT NULL, `SMT_CHIP` double DEFAULT NULL, `SMT_FINE_RATE` double DEFAULT NULL, `SMT_FINE_NO` double DEFAULT NULL, `SMT_FINE` double DEFAULT NULL, `PTH_RATE` double DEFAULT NULL, `PTH_NO` double DEFAULT NULL, `PTH` double DEFAULT NULL, `MAN_RATE` double DEFAULT NULL, `MAN_NO` double DEFAULT NULL, `MAN` double DEFAULT NULL, `TOT_ASSEMBLY` double DEFAULT NULL, `PROG_RATE` double DEFAULT NULL, `PROG_TIME` double DEFAULT NULL, `PROG` double DEFAULT NULL, `XRAY_RATE` double DEFAULT NULL, `XRAY_TIME` double DEFAULT NULL, `XRAY` double DEFAULT NULL, `ICT_RATE` double DEFAULT NULL, `ICT_TIME` double DEFAULT NULL, `ICT` double DEFAULT NULL, `FCT_RATE` double DEFAULT NULL, `FCT_TIME` double DEFAULT NULL, `FCT` double DEFAULT NULL, `TOT_TEST` double DEFAULT NULL, `O_AGR_CWP` double DEFAULT NULL, `PACK_RATE` double DEFAULT NULL, `PACK_TIME` double DEFAULT NULL, `PACK` double DEFAULT NULL, `PROFIT_RATE` double DEFAULT NULL, `PROFIT` double DEFAULT NULL, `ERI_SPECIFIC_EQ` double DEFAULT NULL, `O_AGR_CWOP` double DEFAULT NULL, `OUTB_FRT_DY` double DEFAULT NULL, `TOT_SELLING` double DEFAULT NULL, KEY `idx1` (`HEAD_PRODNO`), KEY `idx2` (`HEAD_RSTATE`), KEY `idx3` (`Level`)) ENGINE=InnoDB DEFAULT CHARSET=utf8'
explain plan for the Update query:
==================================
mysql> explain UPDATE BCT_VA_RES1_TMP,BCT_PROD SET BCT_VA_RES1_TMP.DESCRIPTION=BCT_PROD.DESCRIPTION WHERE BCT_VA_RES1_TMP.HEAD_PRODNO=BCT_PROD.PRODNO AND BCT_VA_RES1_TMP.HEAD_RSTATE=BCT_PROD.RSTATE AND BCT_VA_RES1_TMP.Level=0
-> ;
+----+-------------+-----------------+------+---------------+------+---------+------+--------+----------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------+------+---------------+------+---------+------+--------+----------------------------------------------------+
| 1 | SIMPLE | BCT_VA_RES1_TMP | ALL | NULL | NULL | NULL | NULL | 113 | Using where |
| 1 | SIMPLE | BCT_PROD | ALL | NULL | NULL | NULL | NULL | 556464 | Using where; Using join buffer (Block Nested Loop) |
+----+-------------+-----------------+------+---------------+------+---------+------+--------+----------------------------------------------------+
2 rows in set (0.03 sec)
Profiling for the update query :
================================
mysql> SHOW PROFILE FOR QUERY 12;
+---------------------------+------------+
| Status | Duration |
+---------------------------+------------+
| starting | 0.000366 |
| checking permissions | 0.000049 |
| checking permissions | 0.000029 |
| Opening tables | 0.000164 |
| checking permissions | 0.000029 |
| checking permissions | 0.000040 |
| init | 0.000144 |
| updating main table | 0.000092 |
| System lock | 0.000065 |
| optimizing | 0.000082 |
| statistics | 0.000473 |
| preparing | 0.000119 |
| executing | 0.000027 |
| Sending data | 904.026944 |
| updating reference tables | 0.000091 |
| end | 0.000043 |
| end | 0.000040 |
| query end | 0.010471 |
| closing tables | 0.000116 |
| freeing items | 0.000151 |
| logging slow query | 0.000030 |
| cleaning up | 0.000092 |
+---------------------------+------------+
22 rows in set, 1 warning (0.00 sec)
Please let me know if you need more info on this.
Thanks in advance