PHPSpreadsheet查询长度是否有限制?

时间:2019-09-19 06:06:48

标签: mysql timeout xlsx phpspreadsheet

我已经创建了一些phpspreadsheet“报告”文件,并且所有这些都运行良好。我已经创建了第三个脚本,但是现在遇到了脚本无法完全运行的问题,现在我想知道PHP电子表格如何读取嵌套查询是否存在限制。

我首先像其他所有脚本一样从头开始创建脚本,然后将其放置一整夜以供运行,但是该脚本在经过很长的时间后就超时了,就像我已有的PHP / Mysql设置一样。

接下来,我尝试运行我现有的脚本之一,并且它像以前一样运行良好。

最后,我将其他报告之一的脚本复制到当前脚本中,以测试没有模板错误,并且该脚本也按预期运行。

我还只在MySQL工作台中运行查询,该查询在不到10秒的时间内返回了结果。

SQLFiddle:http://sqlfiddle.com/#!9/3c754eb/1

我已经添加了查询,并删除了嵌套表,只是为了查看查询本身。

SELECT 
    CALLING.StoreCode       AS  'STORE CODE'
,   CALLING.RouteCode           AS  'ROUTE CODE'
,   CALLING.ScheduledActionDate AS  'SCHEDULED ACTION DATE'
,   CALLING.ActualVisitedDate   AS  'ACTUAL VISIT DATE'
,   CALLING.CycleEndDate        AS  'CYCLE END DATE'
,   CALLING.CallingDay      AS  'CALLING DAY'
,   CASE 
        WHEN OUTEXCLUSIONS.ExcludedDate IS NOT NULL THEN 0
        WHEN EXCLUSIONS.ExcludedDate IS NOT NULL THEN 0 
        ELSE 1
    END             AS  'OUTLET CALLING STATUS' 
,   CALLING.UserName        AS  'USERNAME'
,   CALLING.Week            AS  'WEEK'
,   CASE 
    WHEN OUTEXCLUSIONS.ExcludedDate IS NOT NULL THEN OUTEXCLUSIONS.ExcludedDate
    WHEN EXCLUSIONS.ExcludedDate IS NOT NULL THEN EXCLUSIONS.ExcludedDate 
        ELSE NULL
    END             AS  'EXCLUSION DATE'

,   CASE 
    WHEN OUTEXCLUSIONS.ExcludedDate IS NOT NULL THEN OUTEXCLUSIONS.LeaveDescription
    WHEN EXCLUSIONS.ExcludedDate IS NOT NULL THEN EXCLUSIONS.LeaveDescription 
        ELSE NULL
    END             AS  'EXCLUSION DESCRIPTION'

FROM 

(SELECT 
    CALLCYCLES.StoreCode
,   CALLCYCLES.ScheduledActionDate
,   VISTED.ActualVisitedDate
,   CALLCYCLES.CycleEndDate
,   CALLCYCLES.CallingDay
,   VISTED.UserName
,   CALLCYCLES.RouteCode
,   CALLCYCLES.Week
,   CALLCYCLES.Requestable
FROM
    (
    NESTED QUERY JOINIG TO ANOTHER NESTED QUERY TO REPLICATE AN FULL JOIN IN MYSQL
    )   AS CALLCYCLES
LEFT JOIN
    (
    NESTED QUERY JOINIG TO ANOTHER NESTED QUERY TO REPLICATE AN FULL JOIN IN MYSQL
    )   VISTED
ON
    CALLCYCLES.StoreCode = VISTED.StoreCode
AND CALLCYCLES.CycleEndDate = VISTED.CycleEndDate

UNION ALL (UNIONING THE TWO NESTED QUERIES)

SELECT
    CALLCYCLES.StoreCode
,   CALLCYCLES.ScheduledActionDate
,   VISTED.ActualVisitedDate
,   CALLCYCLES.CycleEndDate
,   CALLCYCLES.CallingDay
,   VISTED.UserName
,   CALLCYCLES.RouteCode
,   CALLCYCLES.Week
,   CALLCYCLES.Requestable
FROM
    (
    NESTED QUERY JOINIG TO ANOTHER NESTED QUERY TO REPLICATE AN FULL JOIN IN MYSQL
    )   AS CALLCYCLES
RIGHT JOIN
    (
    NESTED QUERY JOINIG TO ANOTHER NESTED QUERY TO REPLICATE AN FULL JOIN IN MYSQL
    )   AS VISTED
ON
    CALLCYCLES.StoreCode = VISTED.StoreCode
AND CALLCYCLES.CycleEndDate = VISTED.CycleEndDate
WHERE CALLCYCLES.StoreCode IS NULL

)       AS CALLING

LEFT JOIN

    (JOINING TO REFERENCE TABLE 1)      AS EXCLUSIONS
ON
    CALLING.RouteCode = EXCLUSIONS.RouteCode
AND CALLING.ScheduledActionDate = EXCLUSIONS.ExcludedDate


LEFT JOIN

    (JOINING TO REFERENCE TABLE 2)      AS OUTEXCLUSIONS
ON
    CALLING.RouteCode = OUTEXCLUSIONS.RouteCode
AND CALLING.ScheduledActionDate = OUTEXCLUSIONS.ExcludedDate
AND CALLING.StoreCode = OUTEXCLUSIONS.StoreCode

不幸的是,除了超时之外,没有错误代码,并且脚本会继续运行直到超时。

0 个答案:

没有答案