|
sa_task表里才500万条数据,就访问很慢;系统里有很多类似下面的语句,怎么样能优化一下表或者重写sql语句吗?
- SELECT SA_Task.sID AS SA_Task,
- SA_Task.SAIACTIVE AS sAIActive,
- SA_Task.SAIID AS sAIID,
- SA_Task.SAISTATUSID AS sAIStatusID,
- SA_Task.SAISTATUSNAME AS sAIStatusName,
- SA_Task.SACTIVE AS sActive,
- SA_Task.SACTIVITY AS sActivity,
- SA_Task.SACTIVITYINTEMPLATE AS sActivityInTemplate,
- SA_Task.SACTIVITYNAME AS sActivityName,
- SA_Task.SACTIVITYNAMES AS sActivityNames,
- SA_Task.SACTUALFINISHTIME AS sActualFinishTime,
- SA_Task.SACTUALSTARTTIME AS sActualStartTime,
- SA_Task.SCURL AS sCURL,
- SA_Task.SCATALOGID AS sCatalogID,
- SA_Task.SCODE AS sCode,
- SA_Task.SCONTENT AS sContent,
- SA_Task.SCREATETIME AS sCreateTime,
- SA_Task.SCREATORDEPTID AS sCreatorDeptID,
- SA_Task.SCREATORDEPTNAME AS sCreatorDeptName,
- SA_Task.SCREATORFID AS sCreatorFID,
- SA_Task.SCREATORFNAME AS sCreatorFName,
- SA_Task.SCREATOROGNID AS sCreatorOgnID,
- SA_Task.SCREATOROGNNAME AS sCreatorOgnName,
- SA_Task.SCREATORPERSONID AS sCreatorPersonID,
- SA_Task.SCREATORPERSONNAME AS sCreatorPersonName,
- SA_Task.SCREATORPOSID AS sCreatorPosID,
- SA_Task.SCREATORPOSNAME AS sCreatorPosName,
- SA_Task.SCUSTOMERID AS sCustomerID,
- SA_Task.SCUSTOMERNAME AS sCustomerName,
- SA_Task.SDATA1 AS sData1,
- SA_Task.SDATA2 AS sData2,
- SA_Task.SDATA3 AS sData3,
- SA_Task.SDATA4 AS sData4,
- SA_Task.SDISTRIBUTETIME AS sDistributeTime,
- SA_Task.SEBFIELD51 AS sEBField51,
- SA_Task.SEBFIELD52 AS sEBField52,
- SA_Task.SEBFIELD53 AS sEBField53,
- SA_Task.SEBFIELD54 AS sEBField54,
- SA_Task.SEDFIELD21 AS sEDField21,
- SA_Task.SEDFIELD22 AS sEDField22,
- SA_Task.SEDFIELD23 AS sEDField23,
- SA_Task.SEDFIELD24 AS sEDField24,
- SA_Task.SEIFIELD41 AS sEIField41,
- SA_Task.SEIFIELD42 AS sEIField42,
- SA_Task.SEIFIELD43 AS sEIField43,
- SA_Task.SEIFIELD44 AS sEIField44,
- SA_Task.SENFIELD11 AS sENField11,
- SA_Task.SENFIELD12 AS sENField12,
- SA_Task.SENFIELD13 AS sENField13,
- SA_Task.SENFIELD14 AS sENField14,
- SA_Task.SESFIELD01 AS sESField01,
- SA_Task.SESFIELD02 AS sESField02,
- SA_Task.SESFIELD03 AS sESField03,
- SA_Task.SESFIELD04 AS sESField04,
- SA_Task.SESFIELD05 AS sESField05,
- SA_Task.SESFIELD06 AS sESField06,
- SA_Task.SESFIELD07 AS sESField07,
- SA_Task.SESFIELD08 AS sESField08,
- SA_Task.SETFIELD31 AS sETField31,
- SA_Task.SETFIELD32 AS sETField32,
- SA_Task.SETFIELD33 AS sETField33,
- SA_Task.SETFIELD34 AS sETField34,
- SA_Task.SEURL AS sEURL,
- SA_Task.SEMERGENCYID AS sEmergencyID,
- SA_Task.SEMERGENCYNAME AS sEmergencyName,
- SA_Task.SEXECUTEMODE AS sExecuteMode,
- SA_Task.SEXECUTEMODE2 AS sExecuteMode2,
- SA_Task.SEXECUTETIME AS sExecuteTime,
- SA_Task.SEXECUTORDEPTID AS sExecutorDeptID,
- SA_Task.SEXECUTORDEPTNAME AS sExecutorDeptName,
- SA_Task.SEXECUTORFID AS sExecutorFID,
- SA_Task.SEXECUTORFNAME AS sExecutorFName,
- SA_Task.SEXECUTORNAMES AS sExecutorNames,
- SA_Task.SEXECUTOROGNID AS sExecutorOgnID,
- SA_Task.SEXECUTOROGNNAME AS sExecutorOgnName,
- SA_Task.SEXECUTORPERSONID AS sExecutorPersonID,
- SA_Task.SEXECUTORPERSONNAME AS sExecutorPersonName,
- SA_Task.SEXECUTORPOSID AS sExecutorPosID,
- SA_Task.SEXECUTORPOSNAME AS sExecutorPosName,
- SA_Task.SEXPECTFINISHTIME AS sExpectFinishTime,
- SA_Task.SEXPECTSTARTTIME AS sExpectStartTime,
- SA_Task.SFLOWID AS sFlowID,
- SA_Task.SFRONTID AS sFrontID,
- SA_Task.SHINTS AS sHints,
- SA_Task.SIMPORTANCEID AS sImportanceID,
- SA_Task.SIMPORTANCENAME AS sImportanceName,
- SA_Task.SKINDID AS sKindID,
- SA_Task.SLASTMODIFYTIME AS sLastModifyTime,
- SA_Task.SLIMITTIME AS sLimitTime,
- SA_Task.SLOCK AS sLock,
- SA_Task.SNAME AS sName,
- SA_Task.sParentID AS sParent,
- SA_Task.SPLANID AS sPlanID,
- SA_Task.SPLANNAME AS sPlanName,
- SA_Task.SPREEMPTMODE AS sPreemptMode,
- SA_Task.SPROCESS AS sProcess,
- SA_Task.SPROCESSNAME AS sProcessName,
- SA_Task.SPROCESSTEMPLATEID AS sProcessTemplateID,
- SA_Task.SPROCESSTEMPLATEID2 AS sProcessTemplateID2,
- SA_Task.SPROCESSTEMPLATEITEMSEQUENCE AS sProcessTemplateItemSequence,
- SA_Task.SPROJECTID AS sProjectID,
- SA_Task.SPROJECTNAME AS sProjectName,
- SA_Task.SREMARK AS sRemark,
- SA_Task.SREMINDMODE AS sRemindMode,
- SA_Task.SRESPONSIBLE AS sResponsible,
- SA_Task.SSEQUENCE AS sSequence,
- SA_Task.SSHORTCUT AS sShortcut,
- SA_Task.SSOURCEID AS sSourceID,
- SA_Task.SSTATUSID AS sStatusID,
- SA_Task.SSTATUSNAME AS sStatusName,
- SA_Task.SSUMMARY AS sSummary,
- SA_Task.STEMPPERMISSIONID AS sTempPermissionID,
- SA_Task.STYPEID AS sTypeID,
- SA_Task.STYPENAME AS sTypeName,
- SA_Task.SVARIABLE AS sVariable,
- SA_Task.SWARNINGTIME AS sWarningTime,
- SA_Task.SWITHDRAW AS sWithdraw,
- SA_Task.VERSION AS version
- FROM SA_Task SA_Task
- WHERE ((SA_Task.SSTATUSID = ?) OR (SA_Task.SSTATUSID = ?))
- AND (? LIKE SA_Task.SEXECUTORFID || ?)
- AND (SA_Task.SEXECUTORFID LIKE ?)
- AND ((SA_Task.SPROCESS <> ?) AND (SA_Task.SPROCESS <> ?) AND
- (SA_Task.SPROCESS <> ?) AND (SA_Task.SPROCESS <> ?) AND
- (SA_Task.SPROCESS <> ?) AND (SA_Task.SPROCESS <> ?) AND
- (SA_Task.SPROCESS <> ?) AND (SA_Task.SPROCESS <> ?) AND
- (SA_Task.SPROCESS <> ?))
- ORDER BY sCreateTime DESC
复制代码
|
|