Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Incomplete
-
10.2.5
Description
Server version: 10.2.5-MariaDB-10.2.5+maria~xenial
|
key_buffer_size=16777216
|
read_buffer_size=131072
|
max_used_connections=22
|
max_threads=42
|
thread_count=28
|
It is possible that mysqld could use up to
|
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 108639 K bytes of memory
|
Hope that's ok; if not, decrease some variables in the equation.
|
|
Thread pointer: 0x7f0d440009a8
|
Attempting backtrace. You can use the following information to find out
|
where mysqld died. If you see no messages after this, something went
|
terribly wrong...
|
stack_bottom = 0x7f0ee442acf8 thread_stack 0x30000
|
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55b612da841e]
|
/usr/sbin/mysqld(handle_fatal_signal+0x305)[0x55b61280bab5]
|
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11670)[0x7f0eed452670]
|
/usr/sbin/mysqld(_ZN7AGGR_OP10put_recordEb+0x9)[0x55b6126c8719]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(+0x4e22ae)[0x55b6126a32ae]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x179)[0x55b6126aa549]
|
/usr/sbin/mysqld(_ZN4JOIN10exec_innerEv+0xa05)[0x55b6126c9435]
|
/usr/sbin/mysqld(_ZN4JOIN4execEv+0x33)[0x55b6126c9693]
|
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xeb)[0x55b6126c97db]
|
/usr/sbin/mysqld(_Z18mysql_derived_fillP3THDP3LEXP10TABLE_LIST+0x107)[0x55b61264fda7]
|
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x28b)[0x55b61264fadb]
|
/usr/sbin/mysqld(_ZN13st_join_table12preread_initEv+0xe0)[0x55b6126aa3c0]
|
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x2d8)[0x55b6126aa6a8]
|
/usr/sbin/mysqld(_ZN4JOIN10exec_innerEv+0xa05)[0x55b6126c9435]
|
/usr/sbin/mysqld(_ZN4JOIN4execEv+0x33)[0x55b6126c9693]
|
/usr/sbin/mysqld(_ZN18st_select_lex_unit4execEv+0x803)[0x55b612707ae3]
|
/usr/sbin/mysqld(_Z11mysql_unionP3THDP3LEXP13select_resultP18st_select_lex_unitm+0x2d)[0x55b61270ab9d]
|
/usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x59)[0x55b6126ca009]
|
/usr/sbin/mysqld(+0x4ab14e)[0x55b61266c14e]
|
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x5eef)[0x55b6126789af]
|
/usr/sbin/mysqld(_ZN13sp_instr_stmt9exec_coreEP3THDPj+0x15)[0x55b61291d5f5]
|
/usr/sbin/mysqld(_ZN13sp_lex_keeper23reset_lex_and_exec_coreEP3THDPjbP8sp_instr+0x99)[0x55b612923779]
|
/usr/sbin/mysqld(_ZN13sp_instr_stmt7executeEP3THDPj+0x205)[0x55b612923da5]
|
/usr/sbin/mysqld(_ZN7sp_head7executeEP3THDb+0x796)[0x55b6129205b6]
|
/usr/sbin/mysqld(_ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE+0x745)[0x55b612921b15]
|
/usr/sbin/mysqld(+0x4aa9d6)[0x55b61266b9d6]
|
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x2622)[0x55b6126750e2]
|
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x28a)[0x55b61267b83a]
|
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x1615)[0x55b61267dbd5]
|
/usr/sbin/mysqld(_Z10do_commandP3THD+0x15e)[0x55b61267ed8e]
|
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x24a)[0x55b612743eca]
|
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x55b61274403d]
|
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76da)[0x7f0eed4486da]
|
/lib/x86_64-linux-gnu/libc.so.6(clone+0x5f)[0x7f0eecaf117f]
|
|
Trying to get some variables.
|
Some pointers may be invalid and cause the dump to abort.
|
Query (0x7f0d441395b0): UnfixedDiffPOsByDate AS ( SELECT po.POLedgerID, po.POLineID, po.transDesc, po.earlyFD, SUM(po.quantity) AS quantity, po.basePrice, po.diffPrice, po.lateFD, po.effPrice, po.isDecaf, po.speciesID, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc AS origin, v.varietalName AS varietal, rp.packDesc, rp.convPounds, g.gradeName, gl.LengthName, gd.DensityShort, gs.ScreenName, poL.orderDate FROM tblPOLedger AS poL INNER JOIN tblPOLine AS po ON poL.POLedgerID = po.POLedgerID LEFT OUTER JOIN tblGrade AS g ON po.gradeID = g.gradeID LEFT OUTER JOIN tblGradeScreen AS gs ON po.ScreenID = gs.ScreenID LEFT OUTER JOIN tblGradeLength AS gl ON po.LengthID = gl.LengthID LEFT OUTER JOIN tblGradeDensity AS gd ON po.DensityID = gd.DensityID LEFT OUTER JOIN tblRawPack AS rp ON po.rawPackID = rp.rawPackID LEFT OUTER JOIN tblOrigin AS o RIGHT OUTER JOIN tblVarietal AS v ON o.originID = v.originID ON po.varietalID = v.varietalID WHERE (po.diffPrice IS NULL) AND (po.basePrice IS NOT NULL) AND (poL.orderDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY po.POLedgerID, po.POLineID, po.transDesc, po.basePrice, po.diffPrice, po.earlyFD, po.lateFD, po.effPrice, po.isDecaf, po.speciesID, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc, v.varietalName, rp.packDesc, rp.convPounds, g.gradeName, gl.LengthName, gd.DensityShort, gs.ScreenName, poL.orderDate ), FixedDiffPurchByDate AS ( SELECT pf.POLineID, SUM(pf.quantity) AS quantity, pfL.fixDate FROM tblPFLine AS pf INNER JOIN tblPFLedger AS pfL ON pf.PFLedgerID = pfL.PFLedgerID WHERE (pf.basePrice IS NULL) AND (pf.diffPrice IS NOT NULL) AND (pfL.fixDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY pf.POLineID, pfL.fixDate ), UnfixedDiffPurchEndDate AS ( SELECT CONCAT('PO ', ino.POLedgerID) AS OrderID, 'Diff' AS FixType, ino.transDesc, ino.quantity - IFNULL(outa.quantity, 0) AS quantity, ino.packDesc, ino.basePrice, ino.diffPrice, ino.origin, ino.varietal, ino.earlyFD, ino.lateFD, DATEDIFF(ino.lateFD, NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) AS DaysTillDue, ino.POLedgerID, ino.convPounds FROM UnfixedDiffPOsByDate AS ino LEFT OUTER JOIN FixedDiffPurchByDate AS outa ON ino.POLineID = outa.POLineID WHERE (ino.quantity - IFNULL(outa.quantity, 0) > 0) ), UnfixedDiffSOsByDate AS ( SELECT SUM(so.quantity) AS quantity, so.SOLineID, so.POLineID, so.basePrice, so.diffPrice, so.earlyFD, so.lateFD, so.effPrice, so.SOLedgerID, po.POLedgerID, po.transDesc, po.speciesID, po.isDecaf, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc AS origin, v.varietalName AS varietal, rp.packDesc, rp.convPounds, gd.DensityShort, g.gradeName, gl.LengthName, gs.ScreenName, poL.orderDate FROM tblGradeLength AS gl RIGHT OUTER JOIN tblPOLedger AS poL INNER JOIN tblPOLine AS po ON poL.POLedgerID = po.POLedgerID LEFT OUTER JOIN tblGradeDensity AS gd ON po.DensityID = gd.DensityID LEFT OUTER JOIN tblRawPack AS rp ON po.rawPackID = rp.rawPackID LEFT OUTER JOIN tblGrade AS g ON po.gradeID = g.gradeID LEFT OUTER JOIN tblVarietal AS v ON po.varietalID = v.varietalID LEFT OUTER JOIN tblOrigin AS o ON v.originID = o.originID LEFT OUTER JOIN tblGradeScreen AS gs ON po.ScreenID = gs.ScreenID ON gl.LengthID = po.LengthID RIGHT OUTER JOIN tblSOLine AS so ON po.POLineID = so.POLineID WHERE (so.basePrice IS NOT NULL) AND (so.diffPrice IS NULL) AND (poL.orderDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY so.SOLineID, so.POLineID, so.basePrice, so.diffPrice, so.earlyFD, so.lateFD, so.effPrice, so.SOLedgerID, po.POLedgerID, po.transDesc, po.speciesID, po.isDecaf, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc, v.varietalName, rp.packDesc, rp.convPounds, gd.DensityShort, g.gradeName, gl.LengthName, gs.ScreenName, poL.orderDate ), FixedDiffSaleByDate AS ( SELECT SOLineID, SUM(quantity) AS quantity, pfL.fixDate FROM tblPFLine AS pf INNER JOIN tblPFLedger AS pfL ON pf.PFLedgerID = pfL.PFLedgerID WHERE (SOLineID IS NOT NULL) AND (basePrice IS NULL) AND (diffPrice IS NOT NULL) AND (pfL.fixDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY SOLineID, pfL.fixDate ), UnfixedDiffSaleEndDate AS ( SELECT CONCAT('SO ',ino.SOLedgerID) AS OrderID, 'Diff' AS FixType, ino.transDesc, ino.quantity - IFNULL(outa.quantity, 0) AS quantity, ino.packDesc, ino.basePrice, ino.diffPrice, ino.origin, ino.varietal, ino.earlyFD, ino.lateFD, DATEDIFF(ino.lateFD, NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) AS DaysTillDue, ino.POLedgerID, ino.convPounds FROM UnfixedDiffSOsByDate AS ino LEFT OUTER JOIN FixedDiffSaleByDate AS outa ON ino.SOLineID = outa.SOLineID WHERE (ino.quantity - IFNULL(outa.quantity, 0) > 0) ), UnfixedBasePOsByDate AS ( SELECT po.POLedgerID, po.POLineID, po.transDesc, SUM(po.quantity) AS quantity, po.basePrice, po.diffPrice, po.earlyFD, po.lateFD, po.effPrice, po.isDecaf, po.speciesID, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc AS origin, v.varietalName AS varietal, rp.packDesc, rp.convPounds, g.gradeName, gl.LengthName, gd.DensityShort, gs.ScreenName, poL.orderDate FROM tblPOLedger AS poL INNER JOIN tblPOLine AS po ON poL.POLedgerID = po.POLedgerID LEFT OUTER JOIN tblGrade AS g ON po.gradeID = g.gradeID LEFT OUTER JOIN tblGradeScreen AS gs ON po.ScreenID = gs.ScreenID LEFT OUTER JOIN tblGradeLength AS gl ON po.LengthID = gl.LengthID LEFT OUTER JOIN tblGradeDensity AS gd ON po.DensityID = gd.DensityID LEFT OUTER JOIN tblRawPack AS rp ON po.rawPackID = rp.rawPackID LEFT OUTER JOIN tblOrigin AS o RIGHT OUTER JOIN tblVarietal AS v ON o.originID = v.originID ON po.varietalID = v.varietalID WHERE (po.basePrice IS NULL) AND (po.diffPrice IS NOT NULL) AND (poL.orderDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY po.POLedgerID, po.POLineID, po.transDesc, po.basePrice, po.diffPrice, po.earlyFD, po.lateFD, po.effPrice, po.isDecaf, po.speciesID, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc, v.varietalName, rp.packDesc, rp.convPounds, g.gradeName, gl.LengthName, gd.DensityShort, gs.ScreenName, poL.orderDate ), FixedBasePurchByDate AS ( SELECT pf.POLineID, SUM(pf.quantity) AS quantity, pfL.fixDate FROM tblPFLine AS pf INNER JOIN tblPFLedger AS pfL ON pf.PFLedgerID = pfL.PFLedgerID WHERE (pf.basePrice IS NOT NULL) AND (pf.diffPrice IS NULL) AND (pfL.fixDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY pf.POLineID, pfL.fixDate ), UnfixedBasePurchEndDate AS ( SELECT CONCAT('PO ',ino.POLedgerID) AS OrderID, 'Base' AS FixType, ino.transDesc, ino.quantity - IFNULL(outa.quantity, 0) AS quantity, ino.packDesc, ino.basePrice, ino.diffPrice, ino.origin, ino.varietal, ino.earlyFD, ino.lateFD, DATEDIFF(ino.lateFD, NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) AS DaysTillDue, ino.POLedgerID, ino.convPounds FROM UnfixedBasePOsByDate AS ino LEFT OUTER JOIN FixedBasePurchByDate AS outa ON ino.POLineID = outa.POLineID WHERE (ino.quantity - IFNULL(outa.quantity, 0) > 0) ), UnfixedBaseSOsByDate AS ( SELECT SUM(so.quantity) AS quantity, so.SOLineID, so.POLineID, so.basePrice, so.diffPrice, so.earlyFD, so.lateFD, so.effPrice, so.SOLedgerID, po.POLedgerID, po.transDesc, po.speciesID, po.isDecaf, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc AS origin, v.varietalName AS varietal, rp.packDesc, rp.convPounds, gd.DensityShort, g.gradeName, gl.LengthName, gs.ScreenName, poL.orderDate FROM tblGradeLength AS gl RIGHT OUTER JOIN tblPOLedger AS poL INNER JOIN tblPOLine AS po ON poL.POLedgerID = po.POLedgerID LEFT OUTER JOIN tblGradeDensity AS gd ON po.DensityID = gd.DensityID LEFT OUTER JOIN tblRawPack AS rp ON po.rawPackID = rp.rawPackID LEFT OUTER JOIN tblGrade AS g ON po.gradeID = g.gradeID LEFT OUTER JOIN tblVarietal AS v ON po.varietalID = v.varietalID LEFT OUTER JOIN tblOrigin AS o ON v.originID = o.originID LEFT OUTER JOIN tblGradeScreen AS gs ON po.ScreenID = gs.ScreenID ON gl.LengthID = po.LengthID RIGHT OUTER JOIN tblSOLine AS so ON po.POLineID = so.POLineID WHERE (so.basePrice IS NULL) AND (so.diffPrice IS NOT NULL) AND (poL.orderDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY so.SOLineID, so.POLineID, so.basePrice, so.diffPrice, so.earlyFD, so.lateFD, so.effPrice, so.SOLedgerID, po.POLedgerID, po.transDesc, po.speciesID, po.isDecaf, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc, v.varietalName, rp.packDesc, rp.convPounds, gd.DensityShort, g.gradeName, gl.LengthName, gs.ScreenName, poL.orderDate ), FixedBaseSaleByDate AS ( SELECT pf.SOLineID, SUM(pf.quantity) AS quantity, pfL.fixDate FROM tblPFLine AS pf INNER JOIN tblPFLedger AS pfL ON pf.PFLedgerID = pfL.PFLedgerID WHERE (pf.SOLineID IS NOT NULL) AND (pf.basePrice IS NOT NULL) AND (pf.diffPrice IS NULL) AND (pfL.fixDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY SOLineID, pfL.fixDate ), UnfixedBaseSaleEndDate AS ( SELECT CONCAT('SO ',ino.SOLedgerID) AS OrderID, 'Base' AS FixType, ino.transDesc, ino.quantity - IFNULL(outa.quantity, 0) AS quantity, ino.packDesc, ino.basePrice, ino.diffPrice, ino.origin, ino.varietal, ino.earlyFD, ino.lateFD, DATEDIFF(ino.lateFD, NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) AS DaysTillDue, ino.POLedgerID, ino.convPounds FROM UnfixedBaseSOsByDate AS ino LEFT OUTER JOIN FixedBaseSaleByDate AS outa ON ino.SOLineID = outa.SOLineID WHERE (ino.quantity - IFNULL(outa.quantity, 0) > 0) ), UnfixedBaseAndDiffPOsByDate AS ( SELECT po.POLedgerID, po.POLineID, po.transDesc, po.earlyFD, SUM(po.quantity) AS quantity, po.basePrice, po.diffPrice, po.lateFD, po.effPrice, po.isDecaf, po.speciesID, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc AS origin, v.varietalName AS varietal, rp.packDesc, rp.convPounds, g.gradeName, gl.LengthName, gd.DensityShort, gs.ScreenName, poL.orderDate FROM tblPOLedger AS poL INNER JOIN tblPOLine AS po ON poL.POLedgerID = po.POLedgerID LEFT OUTER JOIN tblGradeScreen AS gs ON po.ScreenID = gs.ScreenID LEFT OUTER JOIN tblGradeLength AS gl ON po.LengthID = gl.LengthID LEFT OUTER JOIN tblGradeDensity AS gd ON po.DensityID = gd.DensityID LEFT OUTER JOIN tblGrade AS g ON po.gradeID = g.gradeID LEFT OUTER JOIN tblRawPack AS rp ON po.rawPackID = rp.rawPackID LEFT OUTER JOIN tblOrigin AS o RIGHT OUTER JOIN tblVarietal AS v ON o.originID = v.originID ON po.varietalID = v.varietalID WHERE (po.basePrice IS NULL) AND (po.diffPrice IS NULL) AND (poL.orderDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY po.POLedgerID, po.POLineID, po.transDesc, po.basePrice, po.diffPrice, po.earlyFD, po.lateFD, po.effPrice, po.isDecaf, po.speciesID, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc, v.varietalName, rp.packDesc, rp.convPounds, g.gradeName, gl.LengthName, gd.DensityShort, gs.ScreenName, poL.orderDate ), FixedBaseAndDiffPurchByDate AS ( SELECT pf.POLineID, SUM(pf.quantity) AS quantity, pfL.fixDate FROM tblPFLine AS pf INNER JOIN tblPFLedger AS pfL ON pf.PFLedgerID = pfL.PFLedgerID WHERE (pf.basePrice IS NOT NULL) AND (pf.diffPrice IS NOT NULL) AND (pfL.fixDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY pf.POLineID, pfL.fixDate ), UnfixedBaseAndDiffPurchEndDate AS ( SELECT CONCAT('PO ',ino.POLedgerID) AS OrderID, 'B & D' AS FixType, ino.transDesc, ino.quantity - IFNULL(outa.quantity, 0) AS quantity, ino.packDesc, ino.basePrice, ino.diffPrice, ino.origin, ino.varietal, ino.earlyFD, ino.lateFD, DATEDIFF(ino.lateFD, NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) AS DaysTillDue, ino.POLedgerID, ino.convPounds FROM UnfixedBaseAndDiffPOsByDate AS ino LEFT OUTER JOIN FixedBaseAndDiffPurchByDate AS outa ON ino.POLineID = outa.POLineID WHERE (ino.quantity - IFNULL(outa.quantity, 0) > 0) ), UnfixedBaseAndDiffSOsByDate AS ( SELECT SUM(so.quantity) AS quantity, so.SOLineID, so.POLineID, so.basePrice, so.diffPrice, so.earlyFD, so.lateFD, so.effPrice, so.SOLedgerID, po.POLedgerID, po.transDesc, po.speciesID, po.isDecaf, po.isFairTrade, po.isOrganic, po.isBirdFriendly, po.isRainForest, o.originDesc AS origin, v.varietalName AS varietal, rp.packDesc, rp.convPounds, gd.DensityShort, g.gradeName, gl.LengthName, gs.ScreenName, poL.orderDate FROM tblGradeLength AS gl RIGHT OUTER JOIN tblPOLedger AS poL INNER JOIN tblPOLine AS po ON poL.POLedgerID = poL.POLedgerID LEFT OUTER JOIN tblGradeDensity AS gd ON po.DensityID = gd.DensityID LEFT OUTER JOIN tblRawPack AS rp ON po.rawPackID = rp.rawPackID LEFT OUTER JOIN tblGrade AS g ON po.gradeID = g.gradeID LEFT OUTER JOIN tblVarietal AS v ON po.varietalID = v.varietalID LEFT OUTER JOIN tblOrigin AS o ON v.originID = o.originID LEFT OUTER JOIN tblGradeScreen AS gs ON po.ScreenID = gs.ScreenID ON gl.LengthID = po.LengthID RIGHT OUTER JOIN tblSOLine AS so ON po.POLineID = so.POLineID WHERE (so.basePrice IS NULL) AND (so.diffPrice IS NULL) AND (poL.orderDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY so.SOLineID, so.POLineID, so.basePrice, so.diffPrice, so.earlyFD, so.lateFD, so.effPrice, so.SOLedgerID, po.POLedgerID, po.transDesc, po.speciesID, po.isDecaf, po.isFairTrade, po.isOrganic, po.isRainForest, po.isBirdFriendly, o.originDesc, v.varietalName, rp.packDesc, rp.convPounds, gd.DensityShort, g.gradeName, gl.LengthName, gs.ScreenName, poL.orderDate ), FixedBaseAndDiffSaleByDate AS ( SELECT SOLineID, SUM(quantity) AS quantity, pfL.fixDate FROM tblPFLine AS pf INNER JOIN tblPFLedger AS pfL ON pf.PFLedgerID = pfL.PFLedgerID WHERE (SOLineID IS NOT NULL) AND (basePrice IS NOT NULL) AND (diffPrice IS NOT NULL) AND (pfL.fixDate <= NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) GROUP BY SOLineID, pfL.fixDate ), UnfixedBaseAndDiffSaleEndDate AS ( SELECT CONCAT('SO ',ino.SOLedgerID) AS OrderID, 'B & D' AS FixType, ino.transDesc, ino.quantity - IFNULL(outa.quantity, 0) AS quantity, ino.packDesc, ino.basePrice, ino.diffPrice, ino.origin, ino.varietal, ino.earlyFD, ino.lateFD, DATEDIFF(ino.lateFD, NAME_CONST('p_ENDDATE',_latin1'2017-04-26' COLLATE 'latin1_swedish_ci')) AS DaysTillDue, ino.POLedgerID, ino.convPounds FROM UnfixedBaseAndDiffSOsByDate AS ino LEFT OUTER JOIN FixedBaseAndDiffSaleByDate AS outa ON ino.SOLineID = outa.SOLineID WHERE (ino.quantity - IFNULL(outa.quantity, 0) > 0) ) SELECT *, quantity * convPounds AS LbsToBeFixed FROM UnfixedDiffPurchEndDate UNION SELECT *, quantity * convPounds AS LbsToBeFixed FROM UnfixedDiffSaleEndDate UNION SELECT *, quantity * convPounds AS LbsToBeFixed FROM UnfixedBasePurchEndDate UNION SELECT *, quantity * convPounds AS LbsToBeFixed FROM UnfixedBaseSaleEndDate UNION SELECT *, quantity * convPounds AS LbsToBeFixed FROM UnfixedBaseAndDiffPurchEndDate UNION SELECT *, quantity * convPounds AS LbsToBeFixed FROM UnfixedBaseAndDiffSaleEndDate
|
Connection ID (thread ID): 436
|
Status: NOT_KILLED
|
|
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
|